internal void InitFromCreationInformation(ContentTypeCreationInformation creation)
 {
     if (creation != null)
     {
         base.ObjectData.Properties["Description"] = creation.Description;
         base.ObjectData.Properties["Group"]       = creation.Group;
         base.ObjectData.Properties["Name"]        = creation.Name;
     }
 }
Example #2
0
        public ContentType Add(ContentTypeCreationInformation parameters)
        {
            ClientRuntimeContext context = base.Context;

            if (base.Context.ValidateOnClient)
            {
                if (parameters == null)
                {
                    throw ClientUtility.CreateArgumentNullException("parameters");
                }
                if (parameters != null)
                {
                    if (parameters.Name == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("parameters.Name");
                    }
                    if (parameters.Group != null && parameters.Group.Length < 1)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.Group");
                    }
                    if (parameters.Group != null && parameters.Group.Length > 128)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.Group");
                    }
                }
            }
            ContentType contentType = new ContentType(context, new ObjectPathMethod(context, base.Path, "Add", new object[]
            {
                parameters
            }));

            contentType.Path.SetPendingReplace();
            ObjectIdentityQuery objectIdentityQuery = new ObjectIdentityQuery(contentType.Path);

            context.AddQueryIdAndResultObject(objectIdentityQuery.Id, contentType);
            context.AddQuery(objectIdentityQuery);
            base.AddChild(contentType);
            contentType.InitFromCreationInformation(parameters);
            return(contentType);
        }