morrisjdev / FileContextCore

FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases.
Apache License 2.0
169 stars 45 forks source link

Dirty fix to support .NET6 and .NET7 #42

Open ikijano opened 1 year ago

ikijano commented 1 year ago

Quick and dirty fix to support .NET6 and .NET7 when keeping EFCore version as is.

I haven't run massive tests but at least simple query doesn't throw when running on .NET6 or .NET7 I think this would fix #40

Before fix FileContextLinqOperatorProvider static constructor would throw following exception when trying query from simple dbset:

      System.TypeInitializationException: The type initializer for 'FileContextCore.Query.Internal.FileContextLinqOperatorProvider' threw an exception.
       ---> System.InvalidOperationException: Sequence contains more than one matching element
         at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
         at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
         at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
         at FileContextCore.Query.Internal.FileContextLinqOperatorProvider..cctor() in C:\source\...\FileContextCore\FileContextCore\Query\Internal\FileContextLinqOperatorProvider.cs:line 175