Ejemplo n.º 1
0
        /// <summary>
        /// Completes identifier for new object and changes hierarchy item name.
        /// Last element of id array considered as the name of new object. This
        /// method sequentially generates new names in form {template}{N} and
        /// checks for existing object with same name. To check it this method
        /// tries to enumerate objects with restriction to whole id.
        /// </summary>
        /// <param name="hierarchy">Server explorer facade object to be used for Server Explorer hierarchy interaction.</param>
        /// <param name="typeName">Object type name.</param>
        /// <param name="id">Array with object identifier.</param>
        /// <param name="template">Template for the new object identifier.</param>
        protected virtual void CompleteNewObjectID(ServerExplorerFacade hierarchy, string typeName, ref object[] id, string template)
        {
            if (hierarchy == null)
            {
                throw new ArgumentNullException("hierarchy");
            }
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (String.IsNullOrEmpty(template))
            {
                throw new ArgumentException(Resources.Error_EmptyString, "template");
            }

            ObjectDescriptor.CompleteNewObjectID(hierarchy, typeName, ref id, template);
        }