本文整理汇总了C#中System.Data.Query.InternalTrees.Command.CreateConditionalOp方法的典型用法代码示例。如果您正苦于以下问题:C# Command.CreateConditionalOp方法的具体用法?C# Command.CreateConditionalOp怎么用?C# Command.CreateConditionalOp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.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>
/// <param name="predicate1"></param>
/// <param name="predicate2"></param>
/// <param name="command"></param>
/// <returns></returns>
internal static Node CombinePredicates(Node predicate1, Node predicate2, Command command)
{
IEnumerable<Node> andParts1 = BreakIntoAndParts(predicate1);
IEnumerable<Node> andParts2 = BreakIntoAndParts(predicate2);
Node result = predicate1;
foreach (Node predicatePart2 in andParts2)
{
bool foundMatch = false;
foreach (Node predicatePart1 in andParts1)
{
if (predicatePart1.IsEquivalent(predicatePart2))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
result = command.CreateNode(command.CreateConditionalOp(OpType.And), result, predicatePart2);
}
}
return result;
}