EF Core FromSqlRaw containing multiple in-clauses not working

103 views Asked by At

Given the following SQL fragment being part of a query passed to FromSqlRaw

and    
paec.areaexchangeid in ({string.Join(", ", areaExchangeIdValues.Select((_, i) => "@p" + i))}) 
and
paec.componentId in ({string.Join(", ", componentIdValues.Select((_, i) => "@p" + (i + areaExchangeIdValues.Length)))})

How do I pass the values for the second in-clause as argument to FromSqlRaw? If I try

var result = dbContext.SomeEntity.FromSqlRaw(query, areaExchangeIdValues, componentIdValues).ToList();

the second integer array is not recognised by EF Core and an exception is thrown:

Unhandled exception. System.InvalidOperationException: The current provider doesn't have a store type mapping for properties of type 'object[]'.

Is there a way to achieve what I am trying to do without resorting to LINQ or is the latter the only option here?

TIA

--norgie

0

There are 0 answers