예제 #1
0
		/// <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);
		}