protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            DatabaseAvailabilityGroupConfiguration databaseAvailabilityGroupConfiguration = (DatabaseAvailabilityGroupConfiguration)base.PrepareDataObject();
            DagConfigurationHelper dagConfigurationHelper = DagConfigurationHelper.Deserialize(databaseAvailabilityGroupConfiguration.ConfigurationXML);

            if (dagConfigurationHelper.Version <= 1)
            {
                if (base.Fields["ServersPerDag"] != null)
                {
                    dagConfigurationHelper.ServersPerDag = this.ServersPerDag;
                }
                if (base.Fields["DatabasesPerServer"] != null)
                {
                    dagConfigurationHelper.DatabasesPerServer = this.DatabasesPerServer;
                }
                if (base.Fields["DatabasesPerVolume"] != null)
                {
                    dagConfigurationHelper.DatabasesPerVolume = this.DatabasesPerVolume;
                }
                if (base.Fields["CopiesPerDatabase"] != null)
                {
                    dagConfigurationHelper.CopiesPerDatabase = this.CopiesPerDatabase;
                }
                if (base.Fields["MinCopiesPerDatabaseForMonitoring"] != null)
                {
                    dagConfigurationHelper.MinCopiesPerDatabaseForMonitoring = this.MinCopiesPerDatabaseForMonitoring;
                }
                this.m_configXML = dagConfigurationHelper.Serialize();
                databaseAvailabilityGroupConfiguration.ConfigurationXML = this.m_configXML;
                TaskLogger.LogExit();
                return(databaseAvailabilityGroupConfiguration);
            }
            throw new DagConfigVersionConflictException(databaseAvailabilityGroupConfiguration.Name, 1, dagConfigurationHelper.Version);
        }
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            this.m_output = new HaTaskOutputHelper("new-databaseavailabiltygroupconfiguration", new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskProgressLoggingDelegate(base.WriteProgress), this.GetHashCode());
            this.m_output.CreateTempLogFile();
            this.m_output.AppendLogMessage("new-dagconfiguration started", new object[0]);
            this.LogCommandLineParameters();
            this.m_dagConfigName = base.Name;
            DagConfigurationHelper dagConfigurationHelper = new DagConfigurationHelper(this.ServersPerDag, this.DatabasesPerServer, this.DatabasesPerVolume, this.CopiesPerDatabase, this.MinCopiesPerDatabaseForMonitoring);

            this.m_dagConfigXML = dagConfigurationHelper.Serialize();
            QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, DatabaseAvailabilityGroupConfigurationSchema.Name, this.m_dagConfigName);

            DatabaseAvailabilityGroupConfiguration[] array = this.ConfigurationSession.Find <DatabaseAvailabilityGroupConfiguration>(null, QueryScope.SubTree, filter, null, 1);
            if (array != null && array.Length > 0)
            {
                base.WriteError(new ADObjectAlreadyExistsException(Strings.NewDagConfigurationErrorDuplicateName(this.m_dagConfigName)), ErrorCategory.InvalidArgument, this.m_dagConfigName);
            }
            base.InternalValidate();
            this.m_output.WriteVerbose(Strings.NewDagConfigurationPassedChecks);
            TaskLogger.LogExit();
        }