I want to represent the datas of an existing local Access DB on a Homepage. For that I use ASP.NET MVC with Framework 4.7.2. I have to use EntityFrameworkCore.Jet, so I can't use Core. Following packages were installed:

  • Microsoft.EntityFrameworkCore.Design
  • Microsoft.EntityFrameworkCore.Tools
  • EntityFrameworkCore.Jet

So I try to scaffold my Database in the Package-Manager-Console:

Scaffold-DbContext “Data Source=C:\...\AKneu.mdb” EntityFrameworkCore.Jet -OutputDir Models

But it throws back an Error:

System.TypeLoadException: The method "Create" in the type "EntityFrameworkCore.Jet.Scaffolding.Internal.JetDatabaseModelFactory" of the assembly "EntityFrameworkCore.Jet, Version = 2.2.0.0, Culture = neutral, PublicKeyToken = adb9793829ddae60" has no implementation.

I couldn't find a reason why it can't find the assembly. Do you have anything in mind, why it doesn't work?

2

There are 2 best solutions below

0
On BEST ANSWER

To use scaffolding you need to use Visual Studio 2015, this is mentioned in the wiki of the GitHub project:

If you already have a database, your can use the Package Manager Console Scaffold-DbContext command to create your model classes from an existing database. This feature is only available in Visual Studio 2015.

I had a similar issue a while ago and noted that in order for scaffolding to work you also need to use the version 2.1.2 of EntityFrameworkCore and the 2.0.0 version of the Jet-Provider. Unfortunately I did not note why this was needed, but it may help you.

0
On

The issue is that you are trying to use the EFCore.Jet 2.2.0 provider with EF Core 3.x. EF Core 2.2 providers are not compatible with EF Core 3.x and will throw this error due to changes in what EF Core 3.x expects of its providers.

To solve this, use the latest release of EF Core 3.1.x (currently release 3.1.10) with the latest release of EFCore.Jet 3.1.x (currently the prerelease 3.1.0-alpha.4) from nuget.org.

EF Core 3.1 and its providers are .NET Standard 2.0 compliant, and therefore support not just .NET (Core) 2.0+, but also .NET Framework 4.6.1+.