/// <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); }
/// <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); }
/// <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; }
/// <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); }