Error when Creating Simple Code-First Entity Framework Core Application

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
anoosher
Posts: 3
Joined: Thu 29 Sep 2016 14:57

Error when Creating Simple Code-First Entity Framework Core Application

Post by anoosher » Thu 29 Sep 2016 15:12

I got an error when I trying to add reference from downloaded devart dot connect dll for .net core

I am in the forth step on http://blog.devart.com/entity-framework ... pport.html
- Creating Simple Code-First Entity Framework Core Application

4.Add our provider-specific assemblies to the project references:
dotConnect common assembly – Devart.Data.dll
Provider-specific assembly Devart.Data.{DataSourceName}.dll: for Oracle it would be Devart.Data.Oracle.dll, for MySQL – Devart.Data.MySql.dll, and so on.
EF7 provider assembly Devart.Data.{DataSourceName}.Entity.EF7.dll: for Oracle it would be Devart.Data.Oracle.Entity.EF7.dll, for MySQL – Devart.Data.MySql.Entity.EF7.dll, and so on.

I am getting the following error when I add the specific dll
.NET Core projects only support referencing .NET framework assemblies in this release. To reference other assemblies, they need to be included in a NuGet package and reference that package.
Folder Path : C:\Program Files (x86)\Devart\dotConnect\Oracle\Entity\EFCore

Please let me know the way of adding this dll to the project references

Thank you !

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by Shalex » Thu 29 Sep 2016 17:23

Please open the project.json file of your project and specify the content of its "frameworks" node.

anoosher
Posts: 3
Joined: Thu 29 Sep 2016 14:57

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by anoosher » Fri 30 Sep 2016 11:14

Hi Shalex,
specify the content of its "frameworks" node
do you mean the dll provided by the devart should be a dependency on the .net core framework?

as follows
“frameworks”: {
“netcoreapp1.0”: {
“imports”: “dnxcore50”,
“dependencies”: {
“Microsoft.NETCore.App“: {
“type”: “platform”,
“version”: “1.0.0”
}
}
},


Please let me have the way of including the dependency in the project.json (The code snippet)

Thank you !

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by Shalex » Fri 30 Sep 2016 18:55

EF Core is being developed by Microsoft for the following target platforms:
  • .NET 4.5.1 and higher -> EF Core for this platform is supported by dotConnect for Oracle
  • .NET Core -> planned
  • Universal Windows Platform -> under review
anoosher wrote:I am in the forth step on http://blog.devart.com/entity-framework ... pport.html
- Creating Simple Code-First Entity Framework Core Application
1. This tutorial is for
New > Project > Visual C# > Windows > Console Application
but you are trying to apply it to
New > Project > Visual C# > .NET Core > Console Application
anoosher wrote:

Code: Select all

“frameworks”: {
“netcoreapp1.0”: {
“imports”: “dnxcore50”,
“dependencies”: {
“Microsoft.NETCore.App“: {
“type”: “platform”,
“version”: “1.0.0”
}
}
},
2. We will notify you when .NET Core assemblies are added to the provider installation. With a current implementation, you can use the Devart.* assemblies with the following framework:

Code: Select all

    "frameworks": {
      "dnx451": {
      }
    }
In this case, please download nuget.exe and create a local package for adding the Devart.* assemblies to your project: https://docs.nuget.org/ndocs/create-pac ... sembly-dll.

For example:

a) run
nuget spec Devart.Data.Oracle.Entity.EFCore.dll

b) rename Devart.Data.Oracle.Entity.EFCore.dll.nuspec -> DevartEFCore.nuspec and edit its content to make it be the following:

Code: Select all

<?xml version="1.0"?>
<package >
  <metadata>
    <id>DevartEFCore</id>
    <version>1.0.0</version>
    <authors>test</authors>
    <owners>test</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package description</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2016</copyright>
    <dependencies>
      <dependency id="Microsoft.EntityFrameworkCore.Relational" version="1.0.1" />
    </dependencies>
  </metadata>
<files>
    <file src="lib\*.*" target="lib" /> 
</files>
</package>
c) create the direcory lib right after DevartEFCore.nuspec and copy these assemblies (from provider's installation folder) to it:
Devart.Data.dll
Devart.Data.Oracle.dll
Devart.Data.Oracle.Entity.EFCore.dll

d) run
nuget pack DevartEFCore.nuspec

e) open your .NET Core project, navigate to Tools > NuGet Package Manager > Package Manager Console, click cogwheel to open Package Manager Settings and add a new package source which will target the directory where DevartEFCore.nupkg resides. Then select this newly created package source in your Package Manager Console and run
install-package DevartEFCore

anoosher
Posts: 3
Joined: Thu 29 Sep 2016 14:57

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by anoosher » Mon 03 Oct 2016 08:12

Thank you very much !
  • .NET 4.5.1 and higher -> EF Core for this platform is supported by dotConnect for Oracle
    .NET Core -> planned
We are developing a web API for Linux platform. So we are definitely need the second option i.e. .NET Core -> planned

So, We have to wait until it's been released.

Thank you again for your descriptive answer!

andreasm
Posts: 2
Joined: Mon 21 Nov 2016 16:28

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by andreasm » Thu 16 Mar 2017 11:48

Regarding Shalex's post on 30 September 2016:
1. I found a nuget at https://www.nuget.org/packages/DevartEFCore/1.0.1/ and included it in the project.json of my EF library
2. I modified the above project.json to use net452 under frameworks
3. I modified the project.json of my Web app
4. I run this:
add-migration -Context DbContextClass -name v02 -Verbose -Project <EFLibrary> -startupproject <WebApp>

and got:
Your target project <EFLibrary> doesn't match your migrations assembly <WebApp>. Either change your target project or change your migrations assembly. Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly(<EFLibrary>)). By default, the migrations assembly is the assembly containing the DbContext.
Change your target project to the migrations project by using the Package Manager Console's Default project drop-down list, or by executing "dotnet ef" from the directory containing the migrations project.

Note that migrations assembly is already defined in DbContextClass:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseOracle(
@"<Connection string>",
b => b.MigrationsAssembly( "<WebApp>"));
}


Please advice.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by Shalex » Mon 20 Mar 2017 12:44

Could you please send us a test project so that we can reproduce the issue in our environment?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Error when Creating Simple Code-First Entity Framework Core Application

Post by Shalex » Tue 30 May 2017 11:55

Devart is glad to announce the release of dotConnect for Oracle 9.4 with support for .NET Core: viewtopic.php?f=1&t=35436.

If you have any questions, feel free to contact us.

Post Reply