added NotContains
This commit is contained in:
@@ -16,6 +16,7 @@ namespace PoweredSoft.DynamicLinq
|
||||
LessThan,
|
||||
LessThanOrEqual,
|
||||
Contains,
|
||||
NotContains,
|
||||
StartsWith,
|
||||
EndsWith,
|
||||
In,
|
||||
|
||||
@@ -97,6 +97,17 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
||||
=> Or(path, ConditionOperators.Contains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
#endregion
|
||||
|
||||
#region not contains
|
||||
public WhereBuilder NotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
|
||||
public WhereBuilder AndNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> And(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
|
||||
public WhereBuilder OrNotContains(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> Or(path, ConditionOperators.NotContains, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
#endregion
|
||||
|
||||
#region starts with
|
||||
public WhereBuilder StartsWith(string path, object value, QueryConvertStrategy convertStrategy = QueryConvertStrategy.ConvertConstantToComparedPropertyOrField, QueryCollectionHandling collectionHandling = QueryCollectionHandling.Any, StringComparison? stringComparision = null)
|
||||
=> And(path, ConditionOperators.StartsWith, value, convertStrategy: convertStrategy, collectionHandling: collectionHandling, stringComparision: stringComparision);
|
||||
|
||||
@@ -61,6 +61,13 @@ namespace PoweredSoft.DynamicLinq.Helpers
|
||||
else
|
||||
ret = Expression.Call(member, Constants.ContainsMethod, constant);
|
||||
}
|
||||
else if (conditionOperator == ConditionOperators.NotContains)
|
||||
{
|
||||
if (member.Type == stringType && stringComparision.HasValue)
|
||||
ret = Expression.GreaterThan(Expression.Not(Expression.Call(member, Constants.IndexOfMethod, constant, Expression.Constant(stringComparision.Value))), Expression.Constant(-1));
|
||||
else
|
||||
ret = Expression.Not(Expression.Call(member, Constants.ContainsMethod, constant));
|
||||
}
|
||||
else if (conditionOperator == ConditionOperators.StartsWith)
|
||||
{
|
||||
if (member.Type == stringType && stringComparision.HasValue)
|
||||
|
||||
Reference in New Issue
Block a user