本文整理汇总了C#中ICriterion.ToBinaryComparisonList方法的典型用法代码示例。如果您正苦于以下问题:C# ICriterion.ToBinaryComparisonList方法的具体用法?C# ICriterion.ToBinaryComparisonList怎么用?C# ICriterion.ToBinaryComparisonList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriterion
的用法示例。
在下文中一共展示了ICriterion.ToBinaryComparisonList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetQueryExpression
/// <summary>
/// Gets a <c>QueryExpression</c> instance with it's properties set to the values supplied
/// </summary>
/// <param name="entityName">The name of the <c>BusinessEntity</c> as a <c>string</c> to be queried</param>
/// <param name="criterion">An <c>ICiterion</c> instance to use for duplicate detection</param>
/// <param name="columnSet">A CRM <c>ColumnSet</c> containing the set of columns to be returned from the query.</param>
/// <exception cref="AdapterException">Thrown if the <c>ICriterion</c> parameter is null</exception>
/// <returns>A <c>QueryExpression</c> that can used to retrieve entities from the CRM Service</returns>
/// <remarks>This method sets the Distinct property of the returned <c>QueryExpression</c> to <c>false</c></remarks>
public static QueryExpression GetQueryExpression(string entityName, ICriterion criterion, ColumnSet columnSet)
{
if (criterion == null)
{
throw new AdapterException(string.Format(CultureInfo.CurrentCulture, Resources.NullICriterionExceptionMessage)) { ExceptionId = ErrorCodes.NullICriterion };
}
QueryExpression queryHelper = new QueryExpression(entityName) { Distinct = false, Criteria = new FilterExpression(), ColumnSet = columnSet };
foreach (BinaryComparison comparison in criterion.ToBinaryComparisonList())
{
if (comparison.Value != null)
{
queryHelper.ColumnSet.AddColumn(comparison.Field.FullName);
queryHelper.Criteria.Conditions.Add(new ConditionExpression(comparison.Field.FullName, GetConditionOperator(comparison.Operator), comparison.Value));
}
}
return queryHelper;
}
开发者ID:Microsoft,项目名称:Instance-Adapter-for-Microsoft-Dynamics-CRM,代码行数:28,代码来源:CrmAdapterUtilities.cs