本文整理汇总了C#中ITypeDefinition.TryFindDescriptorInHierarchy方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefinition.TryFindDescriptorInHierarchy方法的具体用法?C# ITypeDefinition.TryFindDescriptorInHierarchy怎么用?C# ITypeDefinition.TryFindDescriptorInHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeDefinition
的用法示例。
在下文中一共展示了ITypeDefinition.TryFindDescriptorInHierarchy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
/// <summary>
/// Checks whether the given type is a shared block.
/// </summary>
/// <param name="context">The <see cref="IMansionContext"/>.</param>
/// <param name="type">The <see cref="ITypeDefinition"/>.</param>
/// <returns>Returns true if the type is a static block, otherwise false.</returns>
public bool Evaluate(IMansionContext context, ITypeDefinition type)
{
// validate arguments
if (context == null)
throw new ArgumentNullException("context");
if (type == null)
throw new ArgumentNullException("type");
// check if this type has a shared block
SharedBlockDescriptor sharedBlockDescriptor;
return type.TryFindDescriptorInHierarchy(out sharedBlockDescriptor);
}
示例2: Evaluate
/// <summary>
/// Gets the label of a particular <paramref name="parentType"/>.
/// </summary>
/// <param name="context">The <see cref="IMansionContext"/>.</param>
/// <param name="parentType">The <see cref="ITypeDefinition"/> which to check for.</param>
/// <param name="childType">The <see cref="ITypeDefinition"/> which to check on.</param>
public bool Evaluate(IMansionContext context, ITypeDefinition parentType, ITypeDefinition childType)
{
// validate arguments
if (context == null)
throw new ArgumentNullException("context");
if (parentType == null)
throw new ArgumentNullException("parentType");
if (childType == null)
return false;
// find the descriptor
CmsBehaviorDescriptor cmsDescriptor;
return parentType.TryFindDescriptorInHierarchy(out cmsDescriptor) && cmsDescriptor.GetBehavior(context).GetAllowedChildTypes(context).Any(childType.IsAssignable);
}
示例3: Evaluate
/// <summary>
/// Gets the label of a particular <paramref name="typeDefinition"/>.
/// </summary>
/// <param name="context">The <see cref="IMansionContext"/>.</param>
/// <param name="typeDefinition">The <see cref="ITypeDefinition"/> for which to get the label.</param>
public bool Evaluate(IMansionContext context, ITypeDefinition typeDefinition)
{
// validate arguments
if (context == null)
throw new ArgumentNullException("context");
if (typeDefinition == null)
throw new ArgumentNullException("typeDefinition");
// find the descriptor
CmsBehaviorDescriptor cmsDescriptor;
if (!typeDefinition.TryFindDescriptorInHierarchy(out cmsDescriptor))
return false;
// return the friendly name
return cmsDescriptor.GetBehavior(context).HasChildren;
}
示例4: PopulateFullTextColumn
/// <summary>
/// Populates the full text property.
/// </summary>
/// <param name="context">The <see cref="IMansionContext"/>.</param>
/// <param name="type">The <see cref="ITypeDefinition"/>.</param>
/// <param name="modifiedProperties">The modified <see cref="IPropertyBag"/>.</param>
/// <param name="originalProperties">The original <see cref="IPropertyBag"/>.</param>
/// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
public static void PopulateFullTextColumn(IMansionContext context, ITypeDefinition type, IPropertyBag modifiedProperties, IPropertyBag originalProperties)
{
// validate arguments
if (context == null)
throw new ArgumentNullException("context");
if (type == null)
throw new ArgumentNullException("type");
if (modifiedProperties == null)
throw new ArgumentNullException("modifiedProperties");
if (originalProperties == null)
throw new ArgumentNullException("originalProperties");
// try to get the full text descriptor
FullTextDescriptor descriptor;
if (!type.TryFindDescriptorInHierarchy(out descriptor))
return;
// index
descriptor.Populate(context, modifiedProperties, originalProperties);
}