Is there anyway making ADO.NET work on .NET Core? - ado.net

I need ODP.NET (Oracle Data Providers for .NET) on .NET Core but can't find anyway to make it work.
When I reference OracleConnection or OracleCommand classes, the project needs System.Data assembly which I can't find in .NET Core.
So isn't there any solution to use ADO.NET on .NET Core?

The System.Data.Common contract is available for providers to start implementing against. So far, the only implementations on .NET Core that I know of are System.Data.SqlClient and Microsoft.Data.Sqlite.

Related

linq to sql upgrade path?

I have a .Net Framework library project containing a bunch of models and business logic based off Linq 2 Sql. I currently have a .Net Framework website consuming it. I want to create a new .Net Core Web API and access this library.
What do I upgrade this library to that will allow it to be consumed by both .Net Framework and .Net core? Is there a ".Net Standard Entity Framework?" I can only see .Net Core EF. So I am at a loss as to how to share this logic layer with my old .net framework and new .net core website.
EF 6.3 runs on .net standard and compatible with Framework and Core.

EF 5/6 in ASP.NET Core 2.0

quick question really. Is the Entity Framework 5/6 supported in ASP.NET Core 2.0. I was told it is not supported and wanted to know if someone has tried it?
Thanks
correct if you are targeting core. You could target the full framework though (even in your asp.net core application)
csproj:
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
...
</PropertyGroup>
https://learn.microsoft.com/en-us/aspnet/core/data/entity-framework-6
No, Entity Framework 6 is not supported by .net core 2.0
But you have some options:
Reference net461 in your project (as it described by user1859022). Then you will able to use full framework libraries, but only on Windows machines.
Reference "Microsoft.EntityFrameworkCore.SqlServer" nuGet package and use Entity Framework Core. It will let you to use it on Linux. But Entity Framework Core is not so good as Entity Framework 6 yet and unfortunately have some restrictions.

Use EF6 with ASP.NET Core

I am working a new project - and I want to do it using the latest .NET Core.
Reading through the documentation, I came across the comparison between Entity Framework Core and Entity Framework 6.x Comparison. Here
Some of the features that I require like: Spatial Data Type is NOT supported by EF Core. So I CAN'T use it, because Spatial Data Type is required in the Project.
Going through the documentation again, I came across this link on How to use EF 6.x with .NET Core: Here
In the article it mentions (Here):
Before you start, make sure that you compile against full .NET
Framework in your project.json as Entity Framework 6 does not support
.NET Core. If you need cross platform features you will need to
upgrade to Entity Framework Core.
I don't really need my project to be cross platform.
The article is not very clear on how to use EF6 with ASP.NET Core.
I created a new ASP.NET Core Web Application
then I installed EF6 using Nuget Package Manager, and got the following error
I went and removed the netcoreapp1.0 from the frameworks in project.json and added net46 as framework, which removed the error for EF, but now I am getting another error.
So how do I use EF6 with ASP.NET core?
When I use EF6 I have to remove all references to .NET Core, does
this mean I am not using .NET Core? What are the disadvantages of this other than it can't run cross platform?
To stop the second error you need to remove the following from the dependencies section of your project.json:
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
For reference, the documentation for referencing the full .NET Framework and Entity Framework 6 from an ASP.NET Core project has a full project.json example.
Removing references to .NET Core does not mean you are not using ASP.NET Core. You are only changing the target runtime platform that your ASP.NET Core project will execute on.
Using ASP.NET Core with the full .NET Framework, you get the benefits of the new project structure and unified story for building web UI and web APIs (e.g. unified Controller class), and you also gain access to the mature, fully-featured .NET Framework, enable use of dependencies and NuGet packages which haven't been ported to .NET Core, for example Entity Framework 6.

Shared library for asp.net core app and windows service

I have an ASP.NET Core web app and a Windows Service that both access the same database. I am using Entity Framework Core as an ORM. I would like to be able to create a library package that encapsulates all data access (ie. a Repository) and can be shared by both the web app and the service.
Entity Framework Core appears to only be supported in DNX applications, and Windows Services, as standard Windows applications, cannot reference DNX projects. Is there any way of creating a DNX Windows Service, or another approach that would work?
Creating a standard windows class library with EF 6.x is not an option as the Repository has already been written in EF Core.
Just discovered my mistake, Entity Framework Core is supported in standard windows projects, so it looks like I have my solution: create a Repository class library that accesses the database using EF Core and reference it from both the ASP.NET Core and Windows Service apps.

Is it possible to use EF 4.0 without having a dependence on .NET 4.0

Lets say I build an Service Layer wich deals with POCOs coming out of an repository. The Repository is aware of the EF 4.0 and deals with POCO generation and so on. But that does also mean that my Repository will have a .NET 4.0 dependency and so my Service Layer which consumes the Repository will also have a .NET 4.0 dependency...even if its dealing only with POCOs and has no clue about the Entity Framework at all. Is there any way to work around this?
You could expose your EF entities using a WCF service - your server-side would be .NET 4 specific, obviously - with EF 4, .NET 4, WCF 4 - but the consumer / client doesn't have to be - if can be anything from any other .NET platform to PHP to Ruby to whatever might be calling your service.