public void WriteDatabaseRecord(DatabaseRecord databaseRecord, SmugglerProgressBase.DatabaseRecordProgress progress, AuthorizationStatus authorizationStatus, DatabaseRecordItemType databaseRecordItemType) { _writer.WritePropertyName(nameof(databaseRecord.DatabaseName)); _writer.WriteString(databaseRecord.DatabaseName); _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Encrypted)); _writer.WriteBool(databaseRecord.Encrypted); if (databaseRecordItemType.Contain(DatabaseRecordItemType.ConflictSolverConfig)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.ConflictSolverConfig)); WriteConflictSolver(databaseRecord.ConflictSolverConfig); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.Settings)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Settings)); WriteSettings(databaseRecord.Settings); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.Revisions)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Revisions)); WriteRevisions(databaseRecord.Revisions); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.Expiration)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Expiration)); WriteExpiration(databaseRecord.Expiration); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.Client)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Client)); WriteClientConfiguration(databaseRecord.Client); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.Sorters)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.Sorters)); WriteSorters(databaseRecord.Sorters); } switch (authorizationStatus) { case AuthorizationStatus.DatabaseAdmin: case AuthorizationStatus.Operator: case AuthorizationStatus.ClusterAdmin: if (databaseRecordItemType.Contain(DatabaseRecordItemType.RavenConnectionStrings)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.RavenConnectionStrings)); WriteRavenConnectionStrings(databaseRecord.RavenConnectionStrings); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.SqlConnectionStrings)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.SqlConnectionStrings)); WriteSqlConnectionStrings(databaseRecord.SqlConnectionStrings); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.PeriodicBackups)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.PeriodicBackups)); WritePeriodicBackups(databaseRecord.PeriodicBackups); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.ExternalReplications)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.ExternalReplications)); WriteExternalReplications(databaseRecord.ExternalReplications); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.RavenEtls)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.RavenEtls)); WriteRavenEtls(databaseRecord.RavenEtls); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.SqlEtls)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.SqlEtls)); WriteSqlEtls(databaseRecord.SqlEtls); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.HubPullReplications)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.HubPullReplications)); WriteHubPullReplications(databaseRecord.HubPullReplications); } if (databaseRecordItemType.Contain(DatabaseRecordItemType.SinkPullReplications)) { _writer.WriteComma(); _writer.WritePropertyName(nameof(databaseRecord.SinkPullReplications)); WriteSinkPullReplications(databaseRecord.SinkPullReplications); } break; } }
public static bool Contain(this DatabaseRecordItemType current, DatabaseRecordItemType flag) { return((current & flag) == flag); }