예제 #1
0
        /// <summary>
        /// Validates the database.  This returns the errors encountered by building.
        /// </summary>
        /// <param name="database">The database object to validate.</param>
        /// <param name="serverEdition">Edition of SQL Server to validate against (Enterprise, Standard, Developer).</param>
        /// <param name="results">Collection of validation results to rbe returned.</param>
        /// <returns>True for 'No Errors', False for 'Error Present'.</returns>
        public static bool ValidateDatabase(Database database, string serverEdition, out ValidationResultCollection results)
        {
            bool doesBuild = false;

            results = new ValidationResultCollection();

            // Validate the Server Edition string
            if (!Enum.IsDefined(typeof(ServerEdition), serverEdition))
            {
                throw new ArgumentException(string.Format("'{0}' is not a valid ServerEdition.", serverEdition));
            }

            ServerEdition edition = (ServerEdition)Enum.Parse(typeof(ServerEdition), serverEdition, true);

            // We have to provide a ServerEdition for this method to work.  There are
            // overloads that look like the will work without them, but they can't be used
            // in this scenario.
            // This can be modified to return warnings and messages as well.
            doesBuild = database.Validate(results, ValidationOptions.None, edition);

            return(doesBuild);
        }
        // Token: 0x06005518 RID: 21784 RVA: 0x001336DC File Offset: 0x001318DC
        private static void EditionSetter(object value, IPropertyBag propertyBag)
        {
            ServerEditionType edition = (ServerEditionType)value;

            propertyBag[FrontendTransportServerADSchema.ServerType] = ServerEdition.EncryptServerEdition(edition);
        }
        // Token: 0x06005517 RID: 21783 RVA: 0x001336B0 File Offset: 0x001318B0
        private static object EditionGetter(IPropertyBag propertyBag)
        {
            string serverTypeInAD = (string)propertyBag[FrontendTransportServerADSchema.ServerType];

            return(ServerEdition.DecryptServerEdition(serverTypeInAD));
        }