/// <summary> /// Adds a <paramref name="childType"/> to this CMS behavior. /// </summary> /// <param name="childType">The <see cref="ChildType"/> which to add.</param> public void Add(ChildType childType) { // validate arguments if (childType == null) throw new ArgumentNullException("childType"); children.Add(childType); }
/// <summary> /// Creates the child type. /// </summary> /// <param name="context"></param> /// <param name="descriptor"></param> /// <param name="behavior"></param> /// <param name="type"></param> private static void CreateChildType(IMansionContext context, ChildTypeDescriptor descriptor, CmsBehavior behavior, ITypeDefinition type) { // create the child type var childType = new ChildType(type); // check if there is an is allowed expression var isAllowedExpressionString = descriptor.Properties.Get(context, "allowedExpression", string.Empty); if (!string.IsNullOrEmpty(isAllowedExpressionString)) { // get the expresion script service var expressionScriptService = context.Nucleus.ResolveSingle<IExpressionScriptService>(); // compile the script childType.IsAllowedExpression = expressionScriptService.Parse(context, new LiteralResource(isAllowedExpressionString)); } behavior.Add(childType); }