.netstandard 2.0 EF /Scaffold-DbContext / Method 'Create' / PublicKeyToken=adb9793829ddae60

iqworks Information Quality Works 236 Reputation points
2022-06-16T16:54:48.367+00:00

Hi , I am using windows 10, version 10.0.19044 build 19044. I am trying to install entity framework to my .net standard 2.0. I have installed :
212174-dot-net-ef-packages3.png
I have seen in places that SQL 2.2.2 should be 3.1?
Unless I missed something the charts show that all is compatible with each other? Maybe
I am missing something?

But this is what happens when I try to build my models :
PM> Scaffold-DbContext “Data Source=.\MSSQLSERVER2012;Initial Catalog= MbsAnalysisData;User Id = eflogin; Password= eflogin2” Microsoft.EntityFrameworkCore.SqlServer -output ModelsEF
Build started...
Build succeeded.
System.TypeLoadException: Method 'Create' in type 'Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
at Microsoft.EntityFrameworkCore.SqlServer.Design.Internal.SqlServerDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices(String provider, IServiceCollection services, Boolean throwOnError)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable1 schemaFilters, IEnumerable1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method 'Create' in type 'Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerDatabaseModelFactory' from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
PM>

Thanks for any advice or suggestions

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
696 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,396 questions
{count} votes

1 answer

Sort by: Most helpful
  1. iqworks Information Quality Works 236 Reputation points
    2022-06-22T15:55:32.433+00:00

    Since I am new to .net standard, I see now that this boils down to how to use EF Core WITH .net standard. Here is a great clue :
    https://devopsjournal.io/blog/2020/04/23/EntityFramework-Core-NET-Standard-Migrations .

    This is the search that i used to get to this above link " using .net standard with entity framework 3.1"

    About the "create" error, I had to make sure I had the same version 3.1) for ALL of the entity framework packages. But the way I was trying to use EF with .net standard was wrong I think.

    0 comments No comments