SenseNet.ContentRepository.TrashBin.AssertRestoreContentType C# (CSharp) Method

AssertRestoreContentType() private static method

private static AssertRestoreContentType ( GenericContent targetParent, Node node ) : void
targetParent GenericContent
node Node
return void
        private static void AssertRestoreContentType(GenericContent targetParent, Node node)
        {
            if (targetParent == null || node == null)
                throw new ArgumentNullException();

            if (!(targetParent is IFolder))
                throw new RestoreException(RestoreResultType.ForbiddenContentType, targetParent.Path);

            var ctNames = targetParent.GetAllowedChildTypeNames().ToArray();

            if (ctNames.Length > 0 && !ctNames.Any(ctName => ctName == node.NodeType.Name))
                throw new RestoreException(RestoreResultType.ForbiddenContentType, targetParent.Path);
        }