CreateDbSetMock throws TypeLoadException
Anas-11 opened this issue · comments
Hallo,
We have currently updated our project to .netcore 3 and Entityframework to v 3.
And now we are getting an exception when trying to create db set mock .
Exception :
System.TypeLoadException : Method 'ExecuteAsync' in type 'EntityFrameworkCoreMock.DbAsyncQueryProvider`1' from assembly 'EntityFrameworkCoreMock.Shared, Version=1.0.0.26, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Code :
var dbMock = new DbContextMock();
dbMock.CreateDbSetMock(m => m.EmailId, _emailIds);
I've tried to support multiple EF versions in one project in the past, but that didn't work out. That's the reason I have an almost identical library for EF6. I think EF Core 3 will cause the same issue as we can't target both. Let me check what should be done here.
hi huysentruitw ,
Thanks for the quick response.
Sorry for the type, we are using EntityFrameworkCore v 3
EF core requires .NET Standard 2.1 so it would be impossible not to support EF Core 3 without a breaking change.
So another NuGet is needed for EFCore 3?
I finally had the time to finish NuGet packages for EFCore 3 support. Please take a look at this project: https://github.com/huysentruitw/entity-framework-core3-mock
If there are any issues for the EF Core 3 version, please open them in there.
Regards!