private void InternalValidateDatabaseMode() { base.InternalValidate(); if (base.HasErrors) { return; } this.m_database = this.DataObject; this.ResolveParameters(); this.CheckDatabaseObject(); if (this.m_database.MasterType != MasterType.DatabaseAvailabilityGroup) { this.m_output.WriteError(new InvalidOperationException(Strings.ErrorSingleDbCopyMove(this.m_database.Name, this.m_database.ServerName)), ErrorCategory.InvalidOperation, this.m_database.Identity); } this.m_dag = DagTaskHelper.ReadDag(this.m_database.MasterServerOrAvailabilityGroup, base.DataSession); if (this.m_dag == null) { this.m_output.WriteError(new InconsistentADException(Strings.InconsistentADDbMasterServerNotADag(this.m_database.Name, this.m_database.MasterServerOrAvailabilityGroup.ToString())), ErrorCategory.InvalidOperation, this.m_database.Identity); } if (this.m_dag.ThirdPartyReplication == ThirdPartyReplicationMode.Enabled) { this.m_output.WriteError(new InvalidTPRTaskException(base.MyInvocation.MyCommand.Name), ErrorCategory.InvalidOperation, this.m_database.Identity); } this.m_startingServer = this.GetCurrentActiveServer(this.m_database.Guid); base.VerifyIsWithinScopes((IConfigurationSession)base.DataSession, DatabaseTasksHelper.GetServerObject(new ServerIdParameter(Fqdn.Parse(this.m_startingServer.Fqdn)), (IConfigurationSession)base.DataSession, this.RootId, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <Server>)), true, new DataAccessTask <Database> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope)); this.PreventMoveOfActiveSeedingSource(this.m_startingServer, new Database[] { this.m_database }); if (this.TargetServerSpecified) { this.PerformTargetServerValidation(); } }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (base.HasErrors) { TaskLogger.LogExit(); return; } if (!this.ClearHostServer && this.m_dbCopy.HostServer != null) { base.VerifyIsWithinScopes((IConfigurationSession)base.DataSession, DatabaseTasksHelper.GetServerObject(new ServerIdParameter(this.m_dbCopy.HostServer), (IConfigurationSession)base.DataSession, this.RootId, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <Server>)), true, new DataAccessTask <DatabaseCopy> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope)); } Database database = this.m_dbCopy.GetDatabase <Database>(); if (database != null) { MapiTaskHelper.VerifyDatabaseIsWithinScope(base.SessionSettings, database, new Task.ErrorLoggerDelegate(base.WriteError)); if (database.Servers != null && database.Servers.Length > 0) { MapiTaskHelper.VerifyServerIsWithinScope(database, new Task.ErrorLoggerDelegate(base.WriteError), (ITopologyConfigurationSession)this.ConfigurationSession); } } if (this.DataObject.IsModified(DatabaseCopySchema.ReplayLag) && this.m_dbCopy.ReplayLagTime != TimeSpan.FromSeconds(0.0)) { this.WriteWarning(Strings.WarningReplayLagTimeMustBeLessThanSafetyNetHoldTime); } }