VahidN / EFSecondLevelCache.Core

Entity Framework Core Second Level Caching Library
Apache License 2.0
326 stars 51 forks source link

Now Microsoft.EntityFrameworkCore (>= 3.1.0) can be used even for .NET Standard 2.0 #60

Closed villanibr closed 4 years ago

villanibr commented 4 years ago

Summary of the issue

Microsoft recently released EF Core 3.1 and it no longer depends on .NET Standard 2.1, only on .NET Standard 2.0. This causes an issue with projects directly referencing EF Core 3.1 and targeting both Framework v4.6.1 AND .NET Standard 2.1, since your lib will try to use >= 2.2.6 for the former and >= 3.0.0 for the later. On EF Core 3.0, there are breaking changes like missing IAsyncEnumerableAccessor: "Reference to type 'IAsyncEnumerableAccessor<>' claims it is defined in 'Microsoft.EntityFrameworkCore', but it could not be found". So when building for Framework v4.6.1, your code is looking for a property on 2.2.6 that no longer exists on >= 3.0.0. Its my understanding that binding redirects won't work on this case. One possible solution is to add Microsoft.EntityFrameworkCore (>= 3.1.0) as dependency for v4.6.1 and/or .NET Standard 2.0.

Environment

.NET Core SDK version: 3.0
Microsoft.EntityFrameworkCore version: 3.1.0
EFSecondLevelCache.Core version: 2.8.2

Example code/Steps to reproduce:

paste your core code

Output:

Exception message: Reference to type 'IAsyncEnumerableAccessor<>' claims it is defined in 'Microsoft.EntityFrameworkCore', but it could not be found
Full Stack trace:
untaught commented 4 years ago

I have the same issue with dotnet core 2.1 with EF Core 3.1.

VahidN commented 4 years ago

Fixed it via #https://github.com/VahidN/EFSecondLevelCache.Core/commit/1560969d9e084f8929273284722cca28827153f4

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.