protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (!base.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007)) { AsciiCharactersOnlyConstraint asciiCharactersOnlyConstraint = new AsciiCharactersOnlyConstraint(); PropertyConstraintViolationError propertyConstraintViolationError = asciiCharactersOnlyConstraint.Validate(this.Name, StorageGroupSchema.Name, null); if (propertyConstraintViolationError != null) { errors.Add(propertyConstraintViolationError); } if (null != this.LogFolderPath) { propertyConstraintViolationError = asciiCharactersOnlyConstraint.Validate(this.LogFolderPath, StorageGroupSchema.LogFolderPath, null); if (propertyConstraintViolationError != null) { errors.Add(propertyConstraintViolationError); } } if (null != this.SystemFolderPath) { propertyConstraintViolationError = asciiCharactersOnlyConstraint.Validate(this.SystemFolderPath, StorageGroupSchema.SystemFolderPath, null); if (propertyConstraintViolationError != null) { errors.Add(propertyConstraintViolationError); } } } if (base.Id.DomainId != null && base.Id.Depth - base.Id.DomainId.Depth < 8) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorInvalidDNDepth, this.Identity, string.Empty)); } }
protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (!base.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007)) { AsciiCharactersOnlyConstraint asciiCharactersOnlyConstraint = new AsciiCharactersOnlyConstraint(); PropertyConstraintViolationError propertyConstraintViolationError = asciiCharactersOnlyConstraint.Validate(this.Name, LegacyDatabaseSchema.Name, null); if (propertyConstraintViolationError != null) { errors.Add(propertyConstraintViolationError); } propertyConstraintViolationError = asciiCharactersOnlyConstraint.Validate(this.EdbFilePath, LegacyDatabaseSchema.EdbFilePath, null); if (propertyConstraintViolationError != null) { errors.Add(propertyConstraintViolationError); } } if (null != this.EdbFilePath && this.EdbFilePath.IsPathInRootDirectory) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorEdbFilePathInRoot(this.EdbFilePath.PathName), this.Identity, string.Empty)); } if (null == this.CopyEdbFilePath == this.HasLocalCopy) { if (null == this.CopyEdbFilePath) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorProperty1EqValue1WhileProperty2EqValue2(LegacyDatabaseSchema.CopyEdbFilePath.Name, "null", LegacyDatabaseSchema.HasLocalCopy.Name, this.HasLocalCopy.ToString()), this.Identity, string.Empty)); } else { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorProperty1NeValue1WhileProperty2EqValue2(LegacyDatabaseSchema.CopyEdbFilePath.Name, "null", LegacyDatabaseSchema.HasLocalCopy.Name, this.HasLocalCopy.ToString()), this.Identity, string.Empty)); } } if (this.HasLocalCopy && null != this.CopyEdbFilePath && null != this.EdbFilePath) { string text = Path.GetFileName(this.EdbFilePath.PathName); string text2 = Path.GetFileName(this.CopyEdbFilePath.PathName); if (!string.Equals(text, text2, StringComparison.OrdinalIgnoreCase)) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorProductFileNameDifferentFromCopyFileName(text, text2), this.Identity, string.Empty)); } text = Path.GetDirectoryName(this.EdbFilePath.PathName); text2 = Path.GetDirectoryName(this.CopyEdbFilePath.PathName); if (string.Equals(text, text2, StringComparison.OrdinalIgnoreCase)) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorProductFileDirectoryIdenticalWithCopyFileDirectory(text), this.Identity, string.Empty)); } if (this.CopyEdbFilePath.IsPathInRootDirectory) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorEdbFilePathInRoot(this.CopyEdbFilePath.PathName), this.Identity, string.Empty)); } } if (base.Id.DomainId != null && base.Id.Depth - base.Id.DomainId.Depth < 8) { errors.Add(new ObjectValidationError(DirectoryStrings.ErrorInvalidDNDepth, this.Identity, string.Empty)); } }