本文整理汇总了C#中FilterExpression.Exclude方法的典型用法代码示例。如果您正苦于以下问题:C# FilterExpression.Exclude方法的具体用法?C# FilterExpression.Exclude怎么用?C# FilterExpression.Exclude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterExpression
的用法示例。
在下文中一共展示了FilterExpression.Exclude方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllowSome2DenySome2
public void AllowSome2DenySome2()
{
var mockQuery = new MockQuery();
var query = mockQuery.Query();
var filterExpression = new FilterExpression<int>();
filterExpression.Include(x1 => x1 >= 2);
filterExpression.Include(x2 => x2 >= 4);
filterExpression.Exclude(x3 => x3 >= 4);
filterExpression.Exclude(x4 => x4 >= 5);
var filteredQuery = GetOpt(filterExpression.GetFilter(), query);
Assert.AreEqual(".Where(x1 => (((x1 >= 2) OrElse (x1 >= 4)) AndAlso (Not((x1 >= 4)) AndAlso Not((x1 >= 5)))))", mockQuery.GetWherePart(filteredQuery));
Assert.AreEqual("2, 3", TestUtility.Dump(filteredQuery));
Assert.AreEqual(1, mockQuery.CallCount);
}
示例2: AllowAllDenySome2
public void AllowAllDenySome2()
{
var mockQuery = new MockQuery();
var query = mockQuery.Query();
var filterExpression = new FilterExpression<int>();
filterExpression.Include(x1 => true);
filterExpression.Exclude(x2 => x2 > 2);
filterExpression.Exclude(x3 => x3 < 2);
var filteredQuery = GetOpt(filterExpression.GetFilter(), query);
Assert.AreEqual(".Where(x2 => (Not((x2 > 2)) AndAlso Not((x2 < 2))))", mockQuery.GetWherePart(filteredQuery));
Assert.AreEqual("2", TestUtility.Dump(filteredQuery));
Assert.AreEqual(1, mockQuery.CallCount);
}
示例3: AllowSomeDenyNone
public void AllowSomeDenyNone()
{
var mockQuery = new MockQuery();
var query = mockQuery.Query();
var filterExpression = new FilterExpression<int>();
filterExpression.Include(x1 => x1 >= 3);
filterExpression.Exclude(x2 => false);
var filteredQuery = GetOpt(filterExpression.GetFilter(), query);
Assert.AreEqual(".Where(x1 => (x1 >= 3))", mockQuery.GetWherePart(filteredQuery));
Assert.AreEqual("3, 4", TestUtility.Dump(filteredQuery));
Assert.AreEqual(1, mockQuery.CallCount);
}
示例4: DenySome
public void DenySome()
{
var mockQuery = new MockQuery();
var query = mockQuery.Query();
var filterExpression = new FilterExpression<int>();
filterExpression.Exclude(x => x >= 3);
var filteredQuery = GetOpt(filterExpression.GetFilter(), query);
Assert.AreEqual("New query: System.Int32[]", mockQuery.GetWherePart(filteredQuery), "Result should be a newly constructed empty array");
Assert.AreEqual("", TestUtility.Dump(filteredQuery));
Assert.AreEqual(0, mockQuery.CallCount, "Empty filter should be optimized to not use original query.");
}
示例5: AllowAllDenyNone
public void AllowAllDenyNone()
{
var mockQuery = new MockQuery();
var query = mockQuery.Query();
var filterExpression = new FilterExpression<int>();
filterExpression.Include(x1 => true);
filterExpression.Exclude(x2 => false);
var filteredQuery = GetOpt(filterExpression.GetFilter(), query);
Assert.AreEqual("", mockQuery.GetWherePart(filteredQuery), "Optimized - No where part");
Assert.AreEqual("1, 2, 3, 4", TestUtility.Dump(filteredQuery));
Assert.AreEqual(1, mockQuery.CallCount);
}