public static Expression<Func<TWhere, bool>> DynamicGreaterOrLessThanWhere<TWhere, TValue>(string propertyName, TValue value, bool greaterThan)
{
var argParam = Expression.Parameter(typeof(TWhere), "i");
var orderProperty = Expression.Property(argParam, propertyName);
var expressionValue = Expression.Constant(value);
BinaryExpression expression = null;
if (orderProperty.Type.IsNullableType())
{
var orderPropertyNotNullable = Expression.Convert(orderProperty, expressionValue.Type);
expression = greaterThan
? Expression.GreaterThan(orderPropertyNotNullable, expressionValue)
: Expression.LessThan(orderPropertyNotNullable, expressionValue);
}
else
{
expression = greaterThan ? Expression.GreaterThan(orderProperty, expressionValue) : Expression.LessThan(orderProperty, expressionValue);
}
return Expression.Lambda<Func<TWhere, bool>>(expression, argParam);
}
if (searchCriteria.Direction.Equals(StorageConstants.Pagination.Newer, StringComparison.CurrentCultureIgnoreCase))
{
var sortPredicate = DynamicGreaterOrLessThanWhere<IInsightSearch, TSort>(sortProperty.Name, entryPointValue, true);
query = query.Where(sortPredicate) ;
}
Body = {(i.PublishDate > 19-Jun-17 12:10:00 PM)}
$i.PublishDate > .Constant<System.DateTime>(19-Jun-17 12:10:00 PM)
query = query.Where(sortPredicate) ;
{PublishDate:{2017-06-19T12:10:00.0000000 TO NULL}}
new System.Linq.Expressions.Expression.MethodCallExpressionProxy(((System.Linq.IQueryable)query).Expression).DebugView
.Call System.Linq.Queryable.Where( .Constant<Raven.Client.Linq.RavenQueryInspector`1[Oak.Repository.Interfaces.IInsightSearch]>(), '(.Lambda #Lambda1<System.Func`2[Oak.Repository.Interfaces.IInsightSearch,System.Boolean]>))
.Lambda #Lambda1<System.Func`2[Oak.Repository.Interfaces.IInsightSearch,System.Boolean]>(Oak.Repository.Interfaces.IInsightSearch $i){ $i.PublishDate > .Constant<System.DateTime>(19-Jun-17 12:10:00 PM)}
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.