Beispiel #1
0
        /// <summary>
        ///     Creates a new version in the database.
        /// </summary>
        /// <param name="source">The workspace that creates the version.</param>
        /// <param name="name">The name of the version.</param>
        /// <param name="access">The access level of the version.</param>
        /// <param name="description">The description of the version.</param>
        /// <param name="deleteExisting">Flag to delete version if it exists</param>
        /// <returns>
        ///     Returns the <see cref="IVersion" /> representing the version that was created; otherwise <c>null</c>
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///     name
        ///     or
        ///     description
        /// </exception>
        public static IVersion CreateVersion(this IWorkspace source, string name, esriVersionAccess access, string description, bool deleteExisting)
        {
            if (source == null)
            {
                return(null);
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            if (deleteExisting)
            {
                source.DeleteVersion(name);
            }

            // Create the version
            IMMVersioningUtils versioningUtils = new MMVersioningUtilsClass();

            return(versioningUtils.CreateVersionFromBase(source, name, description, access));
        }