mirror of
https://github.com/Biarity/Sieve.git
synced 2024-12-04 19:16:24 +01:00
pass filter values as parameters (#112)
make GetClosureOverConstant really work
This commit is contained in:
parent
7a48ba8d61
commit
ec6c310bf1
@ -337,12 +337,10 @@ namespace Sieve.Services
|
||||
}
|
||||
|
||||
// Workaround to ensure that the filter value gets passed as a parameter in generated SQL from EF Core
|
||||
// See https://github.com/aspnet/EntityFrameworkCore/issues/3361
|
||||
// Expression.Constant passed the target type to allow Nullable comparison
|
||||
// See http://bradwilson.typepad.com/blog/2008/07/creating-nullab.html
|
||||
private static Expression GetClosureOverConstant<T>(T constant, Type targetType)
|
||||
{
|
||||
return Expression.Constant(constant, targetType);
|
||||
Expression<Func<T>> hoistedConstant = () => constant;
|
||||
return Expression.Convert(hoistedConstant.Body, targetType);
|
||||
}
|
||||
|
||||
private IQueryable<TEntity> ApplySorting<TEntity>(TSieveModel model, IQueryable<TEntity> result,
|
||||
|
Loading…
Reference in New Issue
Block a user