本文整理汇总了C#中System.Data.Entity.Core.Query.InternalTrees.Command.CreateConditionalOp方法的典型用法代码示例。如果您正苦于以下问题:C# Command.CreateConditionalOp方法的具体用法?C# Command.CreateConditionalOp怎么用?C# Command.CreateConditionalOp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Entity.Core.Query.InternalTrees.Command
的用法示例。
在下文中一共展示了Command.CreateConditionalOp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombinePredicates
// <summary>
// Combine two predicates by trying to avoid the predicate parts of the
// second one that are already present in the first one.
// In particular, given two nodes, predicate1 and predicate2,
// it creates a combined predicate logically equivalent to
// predicate1 AND predicate2,
// but it does not include any AND parts of predicate2 that are present
// in predicate1.
// </summary>
internal static Node CombinePredicates(Node predicate1, Node predicate2, Command command)
{
var andParts1 = BreakIntoAndParts(predicate1);
var andParts2 = BreakIntoAndParts(predicate2);
var result = predicate1;
foreach (var predicatePart2 in andParts2)
{
var foundMatch = false;
foreach (var predicatePart1 in andParts1)
{
if (predicatePart1.IsEquivalent(predicatePart2))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
result = command.CreateNode(command.CreateConditionalOp(OpType.And), result, predicatePart2);
}
}
return result;
}