本文整理匯總了C#中System.Linq.Expressions.Expression.Or方法的典型用法代碼示例。如果您正苦於以下問題:C# Expression.Or方法的具體用法?C# Expression.Or怎麽用?C# Expression.Or使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.Or方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: filterPosts
public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
{
if (operation != 1 && operation != 2 && operation != 3)
{
return predicate;
}
if (this.isOr)
{
Debug.WriteLine("Or " + this.operation + " on " + this.date.Date);
switch (operation)
{
case 1: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
case 2: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
case 3: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
default: return predicate;
}
}
else
{
Debug.WriteLine("And " + this.operation + " on " + this.date.Date);
switch (operation)
{
case 1: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
case 2: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
case 3: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
default: return predicate;
}
}
}
示例2: filterPosts
public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
{
if (this.isOr)
{
Debug.WriteLine("Or " + this.min_date.Date + " to " + this.max_date.Date);
return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
}
else
{
Debug.WriteLine("And " + this.min_date.Date + " to " + this.max_date.Date);
return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
}
}
示例3: filterPosts
public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
{
this.username = this.username ?? "";
if (this.isOr)
{
Debug.WriteLine("Or " + this.username);
return predicate.Or(x => x.Account.username.Equals(this.username));
}
else
{
Debug.WriteLine("And " + this.username);
return predicate.And(x => x.Account.username.Equals(this.username));
}
}
示例4: filterPosts
public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
{
this.search_contents = this.search_contents ?? "";
if (this.isOr)
{
Debug.WriteLine("Or " + this.search_contents);
return predicate.Or(x => x.entry.Contains(this.search_contents));
}
else
{
Debug.WriteLine("And " + this.search_contents);
return predicate.And(x => x.entry.Contains(this.search_contents));
}
}
示例5: TestOr_LeftIsNull
public void TestOr_LeftIsNull() {
_expression1 = null;
var andExpression = _expression1.Or( _expression2 ).ToLambda<Func<Person, bool>>( _parameterExpression );
Expression<Func<Person, bool>> expected = t => t.Birthday.Value.Year > 2000;
Assert.AreEqual( expected.ToString(), andExpression.ToString() );
}