protected override void SetIsoState(DataContext sourceDataContext, DataContext targetDataContext, DataSyncAction syncAction, StringCollection stringCollection, string delimiter) { switch (syncAction.Type) { case DataSyncOperationType.CreateAggregateFunction: case DataSyncOperationType.CreateInlineTableValuedFunction: case DataSyncOperationType.CreateScalarFunction: case DataSyncOperationType.CreateStoredProcedure: case DataSyncOperationType.CreateTableValuedFunction: case DataSyncOperationType.CreateTrigger: case DataSyncOperationType.CreateView: case DataSyncOperationType.AlterAggregateFunction: case DataSyncOperationType.AlterInlineTableValuedFunction: case DataSyncOperationType.AlterScalarFunction: case DataSyncOperationType.AlterStoredProcedure: case DataSyncOperationType.AlterTableValuedFunction: case DataSyncOperationType.AlterTrigger: case DataSyncOperationType.AlterView: IModule module = null; if (syncAction.DataObject is IModule) { module = (IModule)syncAction.DataObject; } if (module != null) { if (CurrentCatalog == null) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, module.Catalog); stringCollection.Add(delimiter); } if (string.Compare(module.Catalog.ObjectName, CurrentCatalog.ObjectName, StringComparison.OrdinalIgnoreCase) != 0) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, module.Catalog); stringCollection.Add(delimiter); } if (module.UsesAnsiNulls && !CurrentAnsiNulls) { SetAnsiNullsOn(stringCollection); stringCollection.Add(delimiter); } else if (!module.UsesAnsiNulls && CurrentAnsiNulls) { SetAnsiNullsOff(stringCollection); stringCollection.Add(delimiter); } if (module.UsesQuotedIdentifier && !CurrentQuotedIdentifier) { SetQuotedIdentifierOn(stringCollection); stringCollection.Add(delimiter); } else if (!module.UsesQuotedIdentifier && CurrentQuotedIdentifier) { SetQuotedIdentifierOff(stringCollection); stringCollection.Add(delimiter); } } if (!CurrentAnsiPadding) { SetAnsiPaddingOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentAnsiWarnings) { SetAnsiWarningsOn(stringCollection); stringCollection.Add(delimiter); } break; case DataSyncOperationType.CreateUserTable: UserTable userTable = null; if (syncAction.DataObject is UserTable) { userTable = (UserTable)syncAction.DataObject; } if (userTable != null) { if (CurrentCatalog == null) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, userTable.Catalog); stringCollection.Add(delimiter); } if (string.Compare(userTable.Catalog.ObjectName, CurrentCatalog.ObjectName, StringComparison.OrdinalIgnoreCase) != 0) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, userTable.Catalog); stringCollection.Add(delimiter); } if (userTable.UsesAnsiNulls && !CurrentAnsiNulls) { SetAnsiNullsOn(stringCollection); stringCollection.Add(delimiter); } else if (!userTable.UsesAnsiNulls && CurrentAnsiNulls) { SetAnsiNullsOff(stringCollection); stringCollection.Add(delimiter); } var createWithAnsiPadding = true; foreach (var userTableColumn in userTable.UserTableColumns) { if (!userTableColumn.IsAnsiPadded && IsDataTypeAnsiPaddable(userTableColumn.DataType)) { createWithAnsiPadding = false; } } if (createWithAnsiPadding && !CurrentAnsiPadding) { SetAnsiPaddingOn(stringCollection); stringCollection.Add(delimiter); } else if (!createWithAnsiPadding && CurrentAnsiPadding) { SetAnsiPaddingOff(stringCollection); stringCollection.Add(delimiter); } } if (!CurrentQuotedIdentifier) { SetQuotedIdentifierOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentAnsiWarnings) { SetAnsiWarningsOn(stringCollection); stringCollection.Add(delimiter); } break; case DataSyncOperationType.AddUserTableColumn: case DataSyncOperationType.AlterUserTableColumn: if (!CurrentAnsiNulls) { SetAnsiNullsOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentQuotedIdentifier) { SetQuotedIdentifierOn(stringCollection); stringCollection.Add(delimiter); } UserTableColumn alteredUserTableColumn = null; if (syncAction.DataObject is UserTableColumn) { alteredUserTableColumn = (UserTableColumn)syncAction.DataObject; } if (alteredUserTableColumn != null) { if (CurrentCatalog == null) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, alteredUserTableColumn.Catalog); stringCollection.Add(delimiter); } if (string.Compare(alteredUserTableColumn.Catalog.ObjectName, CurrentCatalog.ObjectName, StringComparison.OrdinalIgnoreCase) != 0) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, alteredUserTableColumn.Catalog); stringCollection.Add(delimiter); } if (alteredUserTableColumn.IsAnsiPadded && !CurrentAnsiPadding) { SetAnsiPaddingOn(stringCollection); stringCollection.Add(delimiter); } else if (!alteredUserTableColumn.IsAnsiPadded && CurrentAnsiPadding) { SetAnsiPaddingOff(stringCollection); stringCollection.Add(delimiter); } } if (CurrentAnsiWarnings) { SetAnsiWarningsOff(stringCollection); stringCollection.Add(delimiter); } break; default: ICatalog catalogBasedDataObject = null; if (syncAction.DataObject is ICatalog) { catalogBasedDataObject = (ICatalog)syncAction.DataObject; } if (catalogBasedDataObject != null) { if (CurrentCatalog == null) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, catalogBasedDataObject.Catalog); stringCollection.Add(delimiter); } if (string.Compare(catalogBasedDataObject.Catalog.ObjectName, CurrentCatalog.ObjectName, StringComparison.OrdinalIgnoreCase) != 0) { ChangeCatalog(sourceDataContext, targetDataContext, stringCollection, catalogBasedDataObject.Catalog); stringCollection.Add(delimiter); } } if (!CurrentAnsiNulls) { SetAnsiNullsOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentQuotedIdentifier) { SetQuotedIdentifierOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentAnsiPadding) { SetAnsiPaddingOn(stringCollection); stringCollection.Add(delimiter); } if (!CurrentAnsiWarnings) { SetAnsiWarningsOn(stringCollection); stringCollection.Add(delimiter); } break; } }
protected override void SetIsoState(DataContext sourceDataContext, DataContext targetDataContext, DataSyncAction syncAction, StringCollection stringCollection, string delimiter) { }