JonPSmith / EfCore.TestSupport

Tools for helping in unit testing applications that use Entity Framework Core
https://www.thereformedprogrammer.net/new-features-for-unit-testing-your-entity-framework-core-5-code/
Other
352 stars 53 forks source link

Method not found: 'Microsoft.EntityFrameworkCore.Scaffolding.Metadata.DatabaseModel #23

Closed ranthonissen closed 4 years ago

ranthonissen commented 4 years ago

After upgrading my solution and test project to .NET Core 3.0, I get this error

System.MissingMethodException : Method not found: 'Microsoft.EntityFrameworkCore.Scaffolding.Metadata.DatabaseModel Microsoft.EntityFrameworkCore.Scaffolding.IDatabaseModelFactory.Create(System.String, System.Collections.Generic.IEnumerable1<System.String>, System.Collections.Generic.IEnumerable1)'. at TestSupport.EfSchemeCompare.CompareEfSql.GetDatabaseModelViaScaffolder(DbContext[] contexts, String configOrConnectionString, IDesignTimeServices designTimeService) at TestSupport.EfSchemeCompare.CompareEfSql.FinishRestOfCompare(String configOrConnectionString, DbContext[] dbContexts, IDesignTimeServices designTimeService) at TestSupport.EfSchemeCompare.CompareEfSql.CompareEfWithDb(String configOrConnectionString, DbContext[] dbContexts) at TestSupport.EfSchemeCompare.CompareEfSql.CompareEfWithDb(DbContext[] dbContexts)

Is there a plan on updating the project to .NET Core 3?

JonPSmith commented 4 years ago

I'm working on it now. It's not trivial.

ranthonissen commented 4 years ago

I thought so... Thank you for the quick response.

JonPSmith commented 4 years ago

This is fixed in Version 3.0.0, which is now out.

ranthonissen commented 4 years ago

Thank you! Works as expected

mjedrzejek commented 4 years ago

I am getting the same error in my test projects (.NET 4.7.2 and also .NET Core 3.1) with:

  1. Microsoft.EntityFrameworkCore v.3.1
  2. EfCore.TestSupport v.3.1

Is there a plan on introducing the same fix in newer versions?

JonPSmith commented 4 years ago

Hi @mjedrzejek,

I confirmed that my EfSchemaCompare feature works with .NET Core 3.1, so I expect the problem is that my EfCore.TestSupport library uses NetStandard2.1, which isn't compatible with NET Framework 4.7.2.

To allow me to produce one NuGet library that would work with both EF Core 2 and EF Core 3 I use the NetStandard2.0/ NetStandard2.1 to detect which version of EF Core you are using (EF Core 3.0 needed NetStandard2.1).

I don't plan to change the EF Core 3 version of the library to support NetStandard2.0.

mjedrzejek commented 4 years ago

OK, thanks for the info!