protected override void DoUpdate <Root>(SchemaList <Constraint, Root> originFields, Constraint node) { Constraint origin = originFields[node.FullName]; if (!Constraint.Compare(origin, node)) { Constraint newNode = (Constraint)node.Clone(originFields.Parent); if (node.IsDisabled == origin.IsDisabled) { newNode.Status = ObjectStatus.Alter; } else { newNode.Status = ObjectStatus.Alter + (int)ObjectStatus.Disabled; } originFields[node.FullName] = newNode; } else { if (node.IsDisabled != origin.IsDisabled) { Constraint newNode = (Constraint)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Disabled; originFields[node.FullName] = newNode; } } }
public Database() : base(null, Enums.ObjectType.Database) { AllObjects = new SearchSchemaBase(); _changesOptions = new List<DatabaseChangeStatus>(); Dependencies = new Dependencies(); TablesTypes = new SchemaList<TableType, Database>(this, AllObjects); UserTypes = new SchemaList<UserDataType, Database>(this, AllObjects); XmlSchemas = new SchemaList<XMLSchema, Database>(this, AllObjects); Schemas = new SchemaList<Schema, Database>(this, AllObjects); Procedures = new SchemaList<StoreProcedure, Database>(this, AllObjects); CLRProcedures = new SchemaList<CLRStoreProcedure, Database>(this, AllObjects); CLRFunctions = new SchemaList<CLRFunction, Database>(this, AllObjects); FileGroups = new SchemaList<FileGroup, Database>(this); Rules = new SchemaList<Rule, Database>(this, AllObjects); DDLTriggers = new SchemaList<Trigger, Database>(this, AllObjects); Synonyms = new SchemaList<Synonym, Database>(this, AllObjects); Assemblies = new SchemaList<Assembly, Database>(this, AllObjects); Views = new SchemaList<View, Database>(this, AllObjects); Users = new SchemaList<User, Database>(this, AllObjects); FullText = new SchemaList<FullText, Database>(this, AllObjects); Functions = new SchemaList<Function, Database>(this, AllObjects); PartitionFunctions = new SchemaList<PartitionFunction, Database>(this, AllObjects); PartitionSchemes = new SchemaList<PartitionScheme, Database>(this, AllObjects); Roles = new SchemaList<Role, Database>(this); Tables = new SchemaList<Table, Database>(this, AllObjects); Defaults = new SchemaList<Default, Database>(this, AllObjects); ActionMessage = new SqlAction(this); }
protected override void DoUpdate <Root>(SchemaList <View, Root> CamposOrigen, View node) { View original = CamposOrigen[node.FullName]; if (!node.Compare(original)) { View newNode = (View)node.Clone(CamposOrigen.Parent); newNode.DependenciesOut.AddRange(original.DependenciesOut); newNode.DependenciesIn.AddRange(original.DependenciesIn); newNode.Status = Enums.ObjectStatusType.AlterStatus; newNode.Indexes = original.Indexes; newNode.Triggers = original.Triggers; if (newNode.IsSchemaBinding) { newNode.Status += (int)Enums.ObjectStatusType.RebuildDependenciesStatus; } if (newNode.HasToRebuild) { newNode.Status += (int)Enums.ObjectStatusType.RebuildStatus; } else { newNode.Status += (int)Enums.ObjectStatusType.AlterBodyStatus; } CamposOrigen[node.FullName] = newNode; original = newNode; } (new CompareIndexes()).GenerateDiferences <View>(original.Indexes, node.Indexes); (new CompareTriggers()).GenerateDiferences <View>(original.Triggers, node.Triggers); }
protected override void DoUpdate <Root>(SchemaList <Table, Root> CamposOrigen, Table node) { if (node.Status != Enums.ObjectStatusType.DropStatus) { Table tablaOriginal = CamposOrigen[node.FullName]; tablaOriginal.OriginalTable = (Table)CamposOrigen[node.FullName].Clone((Database)tablaOriginal.Parent); (new CompareColumns()).GenerateDiferences <Table>(tablaOriginal.Columns, node.Columns); (new CompareConstraints()).GenerateDiferences <Table>(tablaOriginal.Constraints, node.Constraints); (new CompareIndexes()).GenerateDiferences <Table>(tablaOriginal.Indexes, node.Indexes); (new CompareTablesOptions()).GenerateDiferences <Table>(tablaOriginal.Options, node.Options); (new CompareTriggers()).GenerateDiferences <Table>(tablaOriginal.Triggers, node.Triggers); (new CompareCLRTriggers()).GenerateDiferences <Table>(tablaOriginal.CLRTriggers, node.CLRTriggers); (new CompareFullTextIndex()).GenerateDiferences <Table>(tablaOriginal.FullTextIndex, node.FullTextIndex); if (!Table.CompareFileGroup(tablaOriginal, node)) { tablaOriginal.FileGroup = node.FileGroup; /*Esto solo aplica a las tablas heap, el resto hace el campo en el filegroup del indice clustered*/ if (!tablaOriginal.HasClusteredIndex) { tablaOriginal.Status = Enums.ObjectStatusType.RebuildStatus; } } if (!Table.CompareFileGroupText(tablaOriginal, node)) { tablaOriginal.FileGroupText = node.FileGroupText; tablaOriginal.Status = Enums.ObjectStatusType.RebuildStatus; } if (node.HasChangeTracking != tablaOriginal.HasChangeTracking) { tablaOriginal.HasChangeTracking = node.HasChangeTracking; tablaOriginal.HasChangeTrackingTrackColumn = node.HasChangeTrackingTrackColumn; tablaOriginal.Status += (int)Enums.ObjectStatusType.DisabledStatus; } } }
public View(ISchemaBase parent) : base(parent, Enums.ObjectType.View, Enums.ScripActionType.AddView, Enums.ScripActionType.DropView) { Indexes = new SchemaList<Index, View>(this, ((Database)parent).AllObjects); Triggers = new SchemaList<Trigger, View>(this, ((Database)parent).AllObjects); CLRTriggers = new SchemaList<CLRTrigger, View>(this, ((Database)parent).AllObjects); }
public View(ISchemaBase parent) : base(parent, Enums.ObjectType.View, Enums.ScripActionType.AddView, Enums.ScripActionType.DropView) { indexes = new SchemaList <Index, View>(this, ((Database)parent).AllObjects); triggers = new SchemaList <Trigger, View>(this, ((Database)parent).AllObjects); clrtriggers = new SchemaList <CLRTrigger, View>(this, ((Database)parent).AllObjects); }
void IDisassemblerComponent.Disassemble(IPipelineContext pContext, IBaseMessage pInMsg) { innerDasm.EnvelopeSpecNames = this.EnvelopeSpecNames; //Important not to add the DocumentSpecNames to the inner disassembler as it will not allow messages //that we want to ignore, that is not the same as AllowUnrecognizedMessage = true as UnrecognizedMessage //means a message without corresponding installed schema //This is also why i could not sublass XmlDasmComp innerDasm.AllowUnrecognizedMessage = true; innerDasm.ValidateDocument = this.ValidateDocument; innerDasm.RecoverableInterchangeProcessing = this.RecoverableInterchangeProcessing; SchemaList documents = this.DocumentSpecNames; foreach (Schema item in documents) { IDocumentSpec documentSpec = pContext.GetDocumentSpecByName(item.SchemaName); string[] messageParts = documentSpec.DocType.Split(new char[] { '#' }); MessageType msgType = new MessageType { RootName = messageParts[1] , TargetNamespace = messageParts[0] }; if (messageTypes.ContainsKey(msgType) == false) { messageTypes.Add(msgType, documentSpec); } } innerDasm.Disassemble(pContext, pInMsg); }
protected override void DoNew <Root>(SchemaList <FullTextIndex, Root> originFields, FullTextIndex node) { FullTextIndex newNode = (FullTextIndex)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <TableOption, Root> CamposOrigen, TableOption node) { TableOption newNode = (TableOption)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
public View(ISchemaBase parent) : base(parent, ObjectType.View, ScriptAction.AddView, ScriptAction.DropView) { Indexes = new SchemaList <Index, View>(this, ((Database)parent).AllObjects); Triggers = new SchemaList <Trigger, View>(this, ((Database)parent).AllObjects); CLRTriggers = new SchemaList <CLRTrigger, View>(this, ((Database)parent).AllObjects); }
protected override void DoUpdate <Root>(SchemaList <PartitionFunction, Root> originFields, PartitionFunction node) { if (!PartitionFunction.Compare(node, originFields[node.FullName])) { PartitionFunction newNode = node; //.Clone(originFields.Parent); newNode.Status = ObjectStatus.Rebuild; originFields[node.FullName] = newNode; } else { if (!PartitionFunction.CompareValues(node, originFields[node.FullName])) { PartitionFunction newNode = node.Clone(originFields.Parent); if (newNode.Values.Count == originFields[node.FullName].Values.Count) { newNode.Status = ObjectStatus.Rebuild; } else { newNode.Status = ObjectStatus.Alter; } newNode.Old = originFields[node.FullName].Clone(originFields.Parent); originFields[node.FullName] = newNode; } } }
protected override void DoNew <Root>(SchemaList <Trigger, Root> originFields, Trigger node) { Trigger newNode = (Trigger)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); }
protected override void DoUpdate <Root>(SchemaList <Constraint, Root> CamposOrigen, Constraint node) { Constraint origen = CamposOrigen[node.FullName]; if (!Constraint.Compare(origen, node)) { Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); if (node.IsDisabled == origen.IsDisabled) { newNode.Status = Enums.ObjectStatusType.AlterStatus; } else { newNode.Status = Enums.ObjectStatusType.AlterStatus + (int)Enums.ObjectStatusType.DisabledStatus; } CamposOrigen[node.FullName] = newNode; } else { if (node.IsDisabled != origen.IsDisabled) { Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.DisabledStatus; CamposOrigen[node.FullName] = newNode; } } }
protected override void DoNew <Root>(SchemaList <Index, Root> originFields, Index node) { Index newNode = (Index)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
public TableType(Database parent) : base(parent, Enums.ObjectType.TableType) { Columns = new Columns <TableType>(this); Constraints = new SchemaList <Constraint, TableType>(this, parent.AllObjects); Indexes = new SchemaList <Index, TableType>(this, parent.AllObjects); }
protected override void DoNew <Root>(SchemaList <TableOption, Root> originFields, TableOption node) { TableOption newNode = (TableOption)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Rule, Root> originFields, Rule node) { Rule newNode = node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Rule, Root> CamposOrigen, Rule node) { Rule newNode = node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
/// <param name="schemas">the collection of <see cref="Schema"/> objects to check for duplicates</param> /// <param name="errors">the collection of error strings to be added to in case of duplicates</param> /// <param name="errorMessage">a configurable error message to be added to the collection</param> private void CheckForDuplicateTargetNamespaces(SchemaList schemas, ArrayList errors, string errorMessage) { // stored all encountered target namespaces ArrayList usedSchemas = new ArrayList(); // if we have schemas defined within the project if (schemas != null && schemas.Count > 0) { // iterate over all schemas within this project foreach (Schema s in schemas) { // if the current schema has a target namespace specified, if (s.TargetNamespace != null && s.TargetNamespace.Length > 0) { // if we encountered the specified target namespace before, if (usedSchemas.Contains(s.TargetNamespace)) { // default to a simple error message if nothing specified if (errorMessage == null || errorMessage.Length == 0) { errorMessage = "duplicate namespace encountered: '{0}'"; } // add the encountered duplicate to the errors to be reported errors.Add(string.Format(errorMessage, s.TargetNamespace)); } else { // add the target namespace as being in use usedSchemas.Add(s.TargetNamespace); } } } } }
public Database() : base(ObjectType1.Database) { //AllObjects = new SearchSchemaBase(); Assemblies = new SchemaList<Assembly, Database>(this); ClrFunctions = new SchemaList<ClrFunction, Database>(this); ClrProcedures = new SchemaList<ClrStoreProcedure, Database>(this); //DdlTriggers = new SchemaList<Trigger, Database>(this); Defaults = new SchemaList<Default, Database>(this); //Dependencies = new Dependencies(); FileGroups = new SchemaList<FileGroup, Database>(); FullText = new SchemaList<FullText, Database>(this); //Functions = new SchemaList<Function, Database>(this); //IsCaseSensitive = true; //Options = PartitionFunctions = new SchemaList<PartitionFunction, Database>(this); PartitionSchemes = new SchemaList<PartitionScheme, Database>(this); Procedures = new SchemaList<StoreProcedure, Database>(this); Properties = new DatabaseProperties(); //Roles = new SchemaList<Role, Database>(); Rules = new SchemaList<Rule, Database>(this); Schemas = new SchemaList<SchemaObsolete, Database>(this); Synonyms = new SchemaList<Synonym, Database>(this); //Tables = new SchemaList<Table, Database>(this); TablesTypes = new SchemaList<TableType, Database>(this); Users = new SchemaList<User1, Database>(this); UserTypes = new SchemaList<UserDataType, Database>(this); //Views = new SchemaList<View, Database>(this); XmlSchemas = new SchemaList<XmlSchema, Database>(this); }
protected override void DoNew <Root>(SchemaList <Constraint, Root> originFields, Constraint node) { Constraint newNode = (Constraint)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Index, Root> CamposOrigen, Index node) { Index newNode = (Index)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected override void DoNew <Root>(SchemaList <FileGroup, Root> originFields, FileGroup node) { FileGroup newNode = (FileGroup)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; /*If the Logical File Name exists in another filegroup, * we must change the new Logical File Name. */ originFields.ForEach(file => { if (file.Status != Enums.ObjectStatusType.DropStatus) { file.Files.ForEach(group => { newNode.Files.ForEach(ngroup => { if (group.CompareFullNameTo(group.FullName, ngroup.FullName) == 0) { newNode.Files[ngroup.FullName].Name = group.Name + "_2"; } }); }); } }); originFields.Add(newNode); }
protected override void DoUpdate <Root>(SchemaList <PartitionFunction, Root> CamposOrigen, PartitionFunction node) { if (!PartitionFunction.Compare(node, CamposOrigen[node.FullName])) { PartitionFunction newNode = node;//.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.RebuildStatus; CamposOrigen[node.FullName] = newNode; } else { if (!PartitionFunction.CompareValues(node, CamposOrigen[node.FullName])) { PartitionFunction newNode = node.Clone(CamposOrigen.Parent); if (newNode.Values.Count == CamposOrigen[node.FullName].Values.Count) { newNode.Status = Enums.ObjectStatusType.RebuildStatus; } else { newNode.Status = Enums.ObjectStatusType.AlterStatus; } newNode.Old = CamposOrigen[node.FullName].Clone(CamposOrigen.Parent); CamposOrigen[node.FullName] = newNode; } } }
public Database() : base(null, Enums.ObjectType.Database) { AllObjects = new SearchSchemaBase(); _changesOptions = new List <DatabaseChangeStatus>(); Dependencies = new Dependencies(); TablesTypes = new SchemaList <TableType, Database>(this, AllObjects); UserTypes = new SchemaList <UserDataType, Database>(this, AllObjects); XmlSchemas = new SchemaList <XMLSchema, Database>(this, AllObjects); Schemas = new SchemaList <Schema, Database>(this, AllObjects); Procedures = new SchemaList <StoreProcedure, Database>(this, AllObjects); CLRProcedures = new SchemaList <CLRStoreProcedure, Database>(this, AllObjects); CLRFunctions = new SchemaList <CLRFunction, Database>(this, AllObjects); FileGroups = new SchemaList <FileGroup, Database>(this); Rules = new SchemaList <Rule, Database>(this, AllObjects); DDLTriggers = new SchemaList <Trigger, Database>(this, AllObjects); Synonyms = new SchemaList <Synonym, Database>(this, AllObjects); Assemblies = new SchemaList <Assembly, Database>(this, AllObjects); Views = new SchemaList <View, Database>(this, AllObjects); Users = new SchemaList <User, Database>(this, AllObjects); FullText = new SchemaList <FullText, Database>(this, AllObjects); Functions = new SchemaList <Function, Database>(this, AllObjects); PartitionFunctions = new SchemaList <PartitionFunction, Database>(this, AllObjects); PartitionSchemes = new SchemaList <PartitionScheme, Database>(this, AllObjects); Roles = new SchemaList <Role, Database>(this); Tables = new SchemaList <Table, Database>(this, AllObjects); Defaults = new SchemaList <Default, Database>(this, AllObjects); ActionMessage = new SqlAction(this); }
protected override void DoUpdate <Root>(SchemaList <View, Root> originFields, View node) { View original = originFields[node.FullName]; if (!node.Compare(original)) { View newNode = (View)node.Clone(originFields.Parent); newNode.DependenciesOut.AddRange(original.DependenciesOut); newNode.DependenciesIn.AddRange(original.DependenciesIn); newNode.Status = ObjectStatus.Alter; newNode.Indexes = original.Indexes; newNode.Triggers = original.Triggers; if (newNode.IsSchemaBinding) { newNode.Status += (int)ObjectStatus.RebuildDependencies; } if (newNode.HasToRebuild) { newNode.Status += (int)ObjectStatus.Rebuild; } else { newNode.Status += (int)ObjectStatus.AlterBody; } originFields[node.FullName] = newNode; original = newNode; } (new CompareIndexes()).GenerateDifferences <View>(original.Indexes, node.Indexes); (new CompareTriggers()).GenerateDifferences <View>(original.Triggers, node.Triggers); }
protected override void DoNew <Root>(SchemaList <Constraint, Root> CamposOrigen, Constraint node) { Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Trigger, Root> CamposOrigen, Trigger node) { Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected virtual void DoNew <Root>(SchemaList <T, Root> originFields, T node) where Root : ISchemaBase { T newNode = node;//.Clone(originFields.Parent); newNode.Parent = originFields.Parent; newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
protected virtual void DoNew <Root>(SchemaList <T, Root> CamposOrigen, T node) where Root : ISchemaBase { T newNode = node;//.Clone(CamposOrigen.Parent); newNode.Parent = CamposOrigen.Parent; newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected override void DoUpdate <Root>(SchemaList <Synonym, Root> originFields, Synonym node) { if (!Synonym.Compare(node, originFields[node.FullName])) { Synonym newNode = node; //.Clone(originFields.Parent); newNode.Status = ObjectStatus.Alter; originFields[node.FullName] = newNode; } }
protected override void DoUpdate <Root>(SchemaList <StoreProcedure, Root> CamposOrigen, StoreProcedure node) { if (!node.Compare(CamposOrigen[node.FullName])) { StoreProcedure newNode = node;//.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.AlterStatus; CamposOrigen[node.FullName] = newNode; } }
protected override void DoUpdate <Root>(SchemaList <XMLSchema, Root> CamposOrigen, XMLSchema node) { if (!node.Compare(CamposOrigen[node.FullName])) { XMLSchema newNode = node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.AlterStatus; CamposOrigen[node.FullName] = newNode; } }
private static void FillColumnsDependencies(SchemaList<XMLSchema, Database> items, string connectionString) { using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand(GetSQLColumnsDependencis(), conn)) { conn.Open(); command.CommandTimeout = 0; using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { items[reader["XMLName"].ToString()].Dependencys.Add(new ObjectDependency(reader["TableName"].ToString(), reader["ColumnName"].ToString(), ConvertType.GetObjectType(reader["Type"].ToString()))); } } } } }
private static void FillColumnsDependencies(DatabaseInfo.VersionNumber DatabaseVersion,SchemaList<UserDataType, Database> types, string connectionString) { if (types == null) throw new ArgumentNullException("types"); using (SqlConnection conn = new SqlConnection(connectionString)) { using (SqlCommand command = new SqlCommand((DatabaseVersion==DatabaseInfo.VersionNumber.SQLServer2000?GetSQLColumnsDependencis2000(): GetSQLColumnsDependencis()), conn)) { conn.Open(); command.CommandTimeout = 0; using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { types[reader["TypeName"].ToString()].Dependencys.Add(new ObjectDependency(reader["TableName"].ToString(), reader["ColumnName"].ToString(), ConvertType.GetObjectType(reader["Type"].ToString()))); } } } } }
protected MsSqlSchemaBase(ObjectType1 objectType1) : base(objectType1) { ExtendedProperties = new SchemaList<ExtendedProperty, SchemaBase>(); }
public Assembly(ISchemaBase parent) : base(parent, Enums.ObjectType.Assembly, Enums.ScripActionType.AddAssembly, Enums.ScripActionType.DropAssembly) { Files = new SchemaList<AssemblyFile,Assembly>(this); }
protected SQLServerSchemaBase(ISchemaBase parent, Enums.ObjectType objectType) : base("[", "]", objectType) { this.Parent = parent; ExtendedProperties = new SchemaList<ExtendedProperty, ISchemaBase>(parent); }
public Assembly() : base(ObjectType1.Assembly, ScripActionType.AddAssembly, ScripActionType.DropAssembly) { Files = new SchemaList<AssemblyFile, Assembly>(); }