SenseNet.ContentRepository.SavingAction.Execute C# (CSharp) Method

Execute() public method

public Execute ( ) : void
return void
        public void Execute()
        {
            var gc = Node.Parent as GenericContent;
            if (gc != null)
                gc.AssertAllowedChildType(Node);

            var autoNamingAllowed = false;
            if (this.Node.AllowIncrementalNaming.HasValue)
                autoNamingAllowed = this.Node.AllowIncrementalNaming.Value;
            else
                autoNamingAllowed = this.Node.Id == 0 && ContentType.GetByName(this.Node.NodeType.Name).AllowIncrementalNaming;

            while (true)
            {
                try
                {
                    Node.Save(this);
                    break;
                }
                catch (Storage.Data.NodeAlreadyExistsException)
                {
                    if (!autoNamingAllowed)
                        throw;

                    this.Node.Name = ContentNamingHelper.IncrementNameSuffixToLastName(Node.Name, Node.ParentId);
                }
            }
        }