neisbut / EntityFramework.MemoryJoin

Extension for EntityFramework for joins to in-memory data
MIT License
56 stars 24 forks source link

Exception Static field requires null instance, non-static field requires non-null instance. (Parameter 'expression') in MappingHelper.GetEntityMapping at Expression.MakeMemberAccess(inParam, member); #27

Closed nicoclau closed 2 years ago

nicoclau commented 2 years ago

Hello I did

var reducedData = guids.Select(x => new 
            {
              Id =  x,                
            }).ToList();

            var queryable = _dbContext.FromLocalList(guids);

I just need to pass a list of guids and returns from the table the row where the primary key is contained in the reducedData like reducedData.contains(PK)

i get the error Exception Static field requires null instance, non-static field requires non-null instance. (Parameter 'expression')

It is when the code calls Expression.MakeMemberAccess(inParam, member); in MappingHelper.GetEntityMapping.

Can you tell me what's is wrong with my calling code? guids is a list of guids.

Thanks

nicoclau commented 2 years ago

I made it work , I could not just pass a list of "pure" Guid so I passed my entities and just take the Guid in the reducedData:

Here xxx is my entity which will be in memory in a list of Guid.

List<xxx> guids;

var reducedData = guids.Select(x => new
            {
                Id = x.MyGuid,
            }).ToList();

var queryable = _dbContext.FromLocalList(reducedData, ValuesInjectionMethod.Auto);