SenseNet.ContentRepository.GenericContent.AllowChildTypes C# (CSharp) Method

AllowChildTypes() public method

public AllowChildTypes ( IEnumerable contentTypes, bool setOnAncestorIfInherits = false, bool throwOnError = true, bool save = false ) : void
contentTypes IEnumerable
setOnAncestorIfInherits bool
throwOnError bool
save bool
return void
        public void AllowChildTypes(IEnumerable<ContentType> contentTypes, bool setOnAncestorIfInherits = false, bool throwOnError = true, bool save = false)
        {
            if (contentTypes == null)
                throw new ArgumentNullException("contentTypeNames");
            switch (this.NodeType.Name)
            {
                case "Folder":
                case "Page":
                    if (setOnAncestorIfInherits)
                    {
                        var parent = this.Parent as GenericContent;
                        if (parent != null)
                        {
                            parent.AllowChildTypes(contentTypes, setOnAncestorIfInherits, throwOnError, true);
                        }
                        else
                        {
                            if (throwOnError)
                                throw GetCannotAllowContentTypeException();
                        }
                    }
                    else
                    {
                        if (throwOnError)
                            throw GetCannotAllowContentTypeException();
                    }
                    return;
                case "SystemFolder":
                    if (throwOnError)
                        throw GetCannotAllowContentTypeException();
                    return;
                default:
                    SetAllowedChildTypes(contentTypes, throwOnError, save); 
                    return;
            }
        }
        private void SetAllowedChildTypes(IEnumerable<ContentType> contentTypes, bool throwOnError = true, bool save = false)

Same methods

GenericContent::AllowChildTypes ( IEnumerable contentTypeNames, bool setOnAncestorIfInherits = false, bool throwOnError = true, bool save = false ) : void