Exemplo n.º 1
0
        public void GenerateSchemaXML(XsdDataBase.TBL_ConnectionRow nConnection, XsdDataBase nDataBaseMap, string nPath)
        {
            var catalogos = CMData.DataBase.DataBase.GetDistinctRows(_DataBaseDataSet.TBL_Object.Select("fk_Connection = " + nConnection.id_Connection), "Catalog_Name");

            foreach (DataRow catalogo in catalogos.Rows)
            {
                try
                {
                    var CatalogConfig = _DataBaseDataSet.TBL_Catalog.FindByfk_ConnectionCatalog_Name(nConnection.id_Connection, catalogo["Catalog_Name"].ToString());

                    var fileName = nPath.TrimEnd('\\') + "\\" + CatalogConfig.Class_Name + "DBManager.map";

                    var schemas = CMData.DataBase.DataBase.GetDistinctRows(nDataBaseMap.TBL_Object.Select("fk_Connection = " + nConnection.id_Connection + " AND Catalog_Name = '" + catalogo["Catalog_Name"] + "' AND Selected = 1"), "Schema_Name");
                    var Maping  = new SchemaMapingManager();

                    foreach (DataRow schema in schemas.Rows)
                    {
                        var SchemaConfig = nDataBaseMap.TBL_Schema.FindByfk_ConnectionSchema_Name(nConnection.id_Connection, schema["Schema_Name"].ToString());

                        Maping.Schemas.Add(SchemaConfig.Schema_Alias, SchemaConfig.Schema_Name);
                    }

                    SchemaMapingManager.Serialize(Maping, fileName);
                }
                catch (Exception ex)
                {
                    _Log.AppendLine(ex.Message);
                }
            }
        }
Exemplo n.º 2
0
        public void RemoveObjects(XsdDataBase ds, int id_Connection, string objectType)
        {
            DataRow[] rows = ds.TBL_Object.Select("fk_Connection = " + id_Connection + " AND Generic_Type = '" + objectType + "'");

            foreach (var row in rows)
            {
                row.Delete();
            }
        }
Exemplo n.º 3
0
        public FormCatalogConfig(XsdDataBase nData)
        {
            InitializeComponent();

            DataBaseDataSet = nData;
            CatalogDataGridView.DataSource = DataBaseDataSet;

            DataBaseDataSet.TBL_Catalog.AcceptChanges();
        }
Exemplo n.º 4
0
        public void RestoreObjectsReturnedInStoredProceduresOld(XsdDataBase dsOriginal, XsdDataBase dsNew, int id_Connection, ref StringBuilder log)
        {
            var spOriginalObjects = FindObjects(dsOriginal, id_Connection, "StoredProcedure");

            foreach (var spOriginalObject in spOriginalObjects)
            {
                var strLog         = new StringBuilder("");
                var originalReturn = (XsdDataBase.TBL_SP_ReturnRow[])(dsOriginal.TBL_SP_Return.Select("fk_Object = " + spOriginalObject.id_Object));

                if (originalReturn.Length > 0)
                {
                    var spNewObject = FindObjectRow(dsNew, spOriginalObject.Catalog_Name, spOriginalObject.Schema_Name, spOriginalObject.Object_Name);

                    if (spNewObject != null)
                    {
                        var newReturn = dsNew.TBL_SP_Return.NewTBL_SP_ReturnRow();

                        newReturn.fk_Object          = spNewObject.id_Object;
                        newReturn.Return_Type        = originalReturn[0].Return_Type;
                        newReturn.Data_Type_Returned = originalReturn[0].Data_Type_Returned;
                        dsNew.TBL_SP_Return.AddTBL_SP_ReturnRow(newReturn);

                        var Return_Type = (ReturnType)(Enum.Parse(typeof(ReturnType), originalReturn[0].Return_Type));

                        if (Return_Type == ReturnType.TablaTipada)
                        {
                            newReturn.Schema_Name_Returned = originalReturn[0].Schema_Name_Returned;
                            newReturn.Object_Name_Returned = originalReturn[0].Object_Name_Returned;
                        }

                        if (strLog.ToString() != "")
                        {
                            dsNew.TBL_SP_Return.RemoveTBL_SP_ReturnRow(newReturn);
                            log.AppendLine("Se Eliminó el tipo de dato retornado del objeto [" + spNewObject.Object_Name + "] ");
                            log.AppendLine(strLog.ToString());
                        }
                    }
                    else
                    {
                        log.AppendLine("El Objeto [" + spOriginalObject.Object_Name + "] no encontrado en la nueva base de datos");
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void RestoreOriginalObjectStoredProcedure(XsdDataBase originalDataBase, XsdDataBase.TBL_ObjectRow oldObject, XsdDataBase.TBL_ObjectRow newObject, ref StringBuilder log, XsdDataBase dtsDataBase)
        {
            var strLogObject = new StringBuilder("");

            if (oldObject != null)
            {
                newObject.Selected = oldObject.Selected;

                // Recuperar las columnas
                var oldColumns = (XsdDataBase.TBL_FieldRow[])(originalDataBase.TBL_Field.Select("fk_Object = " + oldObject.id_Object));

                foreach (var oldColumn in oldColumns)
                {
                    var newColumn = dtsDataBase.TBL_Field.NewTBL_FieldRow();

                    newColumn.fk_Object        = newObject.id_Object;
                    newColumn.Field_Name       = oldColumn.Field_Name;
                    newColumn.Field_Type       = oldColumn.Field_Type;
                    newColumn.Specific_Type    = oldColumn.Specific_Type;
                    newColumn.Is_Nullable      = oldColumn.Is_Nullable;
                    newColumn.Max_Length       = oldColumn.Max_Length;
                    newColumn.Precision        = oldColumn.Precision;
                    newColumn.Scale            = oldColumn.Scale;
                    newColumn.PrimaryKey_Order = oldColumn.PrimaryKey_Order;
                    newColumn.Direction        = oldColumn.Direction;
                    dtsDataBase.TBL_Field.AddTBL_FieldRow(newColumn);
                }

                newObject.Mapped = true;

                if (strLogObject.ToString() != "")
                {
                    log.AppendLine("Se encontraron errores en el procedimiento almacenado [" + oldObject.Object_Name + "]");
                    log.AppendLine(strLogObject.ToString());
                    newObject.Mapped = false;
                }
            }
            else
            {
                log.AppendLine("El procedimiento almacenado [" + newObject.Object_Name + "] ha sido agregado recientemente");
                newObject.Mapped = false;
            }
        }
Exemplo n.º 6
0
        public void RemoveObjectsReturnedInStoredProcedures(XsdDataBase ds, int id_Connection)
        {
            var spRows = FindObjects(ds, id_Connection, "StoredProcedure");

            foreach (var spRow in spRows)
            {
                var oldSPReturns = (XsdDataBase.TBL_SP_ReturnRow[])ds.TBL_SP_Return.Select("fk_Object = " + spRow.id_Object);

                if (oldSPReturns.Length > 0)
                {
                    var Return_Type = (ReturnType)(Enum.Parse(typeof(ReturnType), oldSPReturns[0].Return_Type));

                    if (Return_Type == ReturnType.TablaTipada)
                    {
                        ds.TBL_SP_Return.RemoveTBL_SP_ReturnRow(oldSPReturns[0]);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void CompareOriginalVsNewObjects(XsdDataBase originalDataBase, XsdDataBase newDataBase, ref StringBuilder log, XsdDataBase.TBL_ConnectionRow SelectedConnection)
        {
            var originalobjects = FindObjects(originalDataBase, SelectedConnection.id_Connection, "Table");

            foreach (var originalObject in originalobjects)
            {
                var newObject = FindObjectRow(newDataBase, originalObject.Catalog_Name, originalObject.Schema_Name, originalObject.Object_Name);

                if (newObject == null)
                {
                    log.AppendLine("La tabla [" + originalObject.Object_Name + "] ha sido eliminada de la base de datos ");
                }
            }

            originalobjects = FindObjects(originalDataBase, SelectedConnection.id_Connection, "View");

            foreach (var originalObject in originalobjects)
            {
                var newObject = FindObjectRow(newDataBase, originalObject.Catalog_Name, originalObject.Schema_Name, originalObject.Object_Name);

                if (newObject == null)
                {
                    log.AppendLine("La vista [" + originalObject.Object_Name + "] ha sido eliminada de la base de datos ");
                }
            }

            originalobjects = FindObjects(originalDataBase, SelectedConnection.id_Connection, "StoredProcedure");

            foreach (var originalObject in originalobjects)
            {
                var newObject = FindObjectRow(newDataBase, originalObject.Catalog_Name, originalObject.Schema_Name, originalObject.Object_Name);

                if (newObject == null)
                {
                    log.AppendLine("El procedimiento [" + originalObject.Object_Name + "] ha sido eliminado de la base de datos ");
                }
            }
        }
Exemplo n.º 8
0
        public XsdDataBase.TBL_ObjectRow FindObjectRow(XsdDataBase ds, string catalogName, string schemaName, string objectName)
        {
            var objects = (XsdDataBase.TBL_ObjectRow[])(ds.TBL_Object.Select("Catalog_Name = '" + catalogName + "' AND Schema_Name = '" + schemaName + "' AND Object_Name = '" + objectName + "'"));

            return(objects.Length > 0 ? objects[0] : null);
        }
Exemplo n.º 9
0
        public XsdDataBase.TBL_ObjectRow FindObjectRow(XsdDataBase ds, int id_Object)
        {
            var objects = (XsdDataBase.TBL_ObjectRow[])(ds.TBL_Object.Select("id_Object = " + id_Object));

            return(objects.Length > 0 ? objects[0] : null);
        }
Exemplo n.º 10
0
 public XsdDataBase.TBL_ObjectRow[] FindObjects(XsdDataBase ds, int id_Connection, string Generic_Type)
 {
     return((XsdDataBase.TBL_ObjectRow[])(ds.TBL_Object.Select("fk_Connection = " + id_Connection + " AND Generic_Type = '" + Generic_Type + "'")));
 }
Exemplo n.º 11
0
        public XsdDataBase.TBL_ObjectRow LoadAndRestoreObjectTable(XsdDataBase.TBL_ObjectRow nOriginalTable, StringBuilder nLog)
        {
            CMData.Manager.DBManager DBM = null;

            try
            {
                if (Connection != null)
                {
                    if (Connection.IsConnection_TypeNull())
                    {
                        DBM = new CMData.Manager.DBManager(Connection.Connection_String);
                    }
                    else
                    {
                        var dbType = (CMData.DataBase.DataBaseType)(Enum.Parse(typeof(CMData.DataBase.DataBaseType), Connection.Connection_Type));
                        DBM = new CMData.Manager.DBManager(dbType, Connection.Connection_String);
                    }

                    DBM.Connection_Open();

                    var newDataBase = new XsdDataBase();
                    var newObject   = newDataBase.TBL_Object.NewTBL_ObjectRow();

                    newObject.Generic_Type = nOriginalTable.Generic_Type;
                    newObject.Object_Type  = nOriginalTable.Object_Type;
                    newObject.Catalog_Name = nOriginalTable.Catalog_Name;
                    newObject.Schema_Name  = nOriginalTable.Schema_Name;
                    newObject.Object_Name  = nOriginalTable.Object_Name;

                    newDataBase.TBL_Object.AddTBL_ObjectRow(newObject);

                    DBM.DataBase.FillDataTableColumns(newDataBase.TBL_Field, newDataBase.TBL_Relation, newObject);
                    DBM.Connection_Close();

                    try { newObject.Selected = nOriginalTable.Selected; }
                    catch { }
                    newObject.Mapped = true;

                    //Restaurar filtros
                    try
                    {
                        var filters = nOriginalTable.GetTBL_FilterRows();

                        foreach (var originalFilter in filters)
                        {
                            var newFilter = newDataBase.TBL_Filter.NewTBL_FilterRow();

                            newFilter.fk_Object = newObject.id_Object;
                            newFilter.Name      = originalFilter.Name;
                            newDataBase.TBL_Filter.AddTBL_FilterRow(newFilter);

                            var  filterFields = originalFilter.GetTBL_Filter_FieldRows();
                            bool isNewFilterFieldsComplete = true;

                            foreach (var originalFilterField in filterFields)
                            {
                                var fieldRows = newDataBase.TBL_Field.Select("Field_Name = '" + originalFilterField.Field_Name + "'");

                                if (fieldRows.Length > 0)
                                {
                                    var newFilterField = newDataBase.TBL_Filter_Field.NewTBL_Filter_FieldRow();

                                    newFilterField.fk_Filter    = newFilter.id_Filter;
                                    newFilterField.Field_Name   = originalFilterField.Field_Name;
                                    newFilterField.Filter_Order = originalFilterField.Filter_Order;

                                    newDataBase.TBL_Filter_Field.AddTBL_Filter_FieldRow(newFilterField);
                                }
                                else
                                {
                                    nLog.AppendLine(ControlChars.Tab + "El campo con nombre [" + originalFilterField.Field_Name + "] no fue encontrado en la base de datos");
                                    isNewFilterFieldsComplete = false;
                                }
                            }

                            if (!isNewFilterFieldsComplete)
                            {
                                nLog.AppendLine(ControlChars.Tab + "El filtro con nombre [" + originalFilter.Name + "] no fue agregado debido a que no coinciden sus campos de filtrado");
                                newFilter.Delete();
                            }
                        }
                    }
                    catch { }

                    return(newObject);
                }

                throw new Exception("Se debe seleccionar una conexión");
            }
            catch (Exception ex)
            {
                if (DBM != null)
                {
                    DBM.Connection_Close();
                }
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 12
0
        public XsdDataBase.TBL_ObjectRow LoadAndRestoreStoredProcedure(XsdDataBase.TBL_ObjectRow nOriginalStoredProcedure, StringBuilder nLog)
        {
            CMData.Manager.DBManager DBM = null;

            try
            {
                if (Connection != null)
                {
                    if (Connection.IsConnection_TypeNull())
                    {
                        DBM = new CMData.Manager.DBManager(Connection.Connection_String);
                    }
                    else
                    {
                        var dbType = (CMData.DataBase.DataBaseType)(Enum.Parse(typeof(CMData.DataBase.DataBaseType), Connection.Connection_Type));
                        DBM = new CMData.Manager.DBManager(dbType, Connection.Connection_String);
                    }

                    DBM.Connection_Open();

                    var newDataBase = new XsdDataBase();
                    var newObject   = newDataBase.TBL_Object.NewTBL_ObjectRow();

                    newObject.Generic_Type = nOriginalStoredProcedure.Generic_Type;
                    newObject.Object_Type  = nOriginalStoredProcedure.Object_Type;
                    newObject.Catalog_Name = nOriginalStoredProcedure.Catalog_Name;
                    newObject.Schema_Name  = nOriginalStoredProcedure.Schema_Name;
                    newObject.Object_Name  = nOriginalStoredProcedure.Object_Name;

                    newDataBase.TBL_Object.AddTBL_ObjectRow(newObject);

                    DBM.DataBase.FillDataBaseParameters(newDataBase.TBL_Field, newObject);

                    try { newObject.Selected = nOriginalStoredProcedure.Selected; }
                    catch { }
                    newObject.Mapped = true;

                    try
                    {
                        var originalSpReturn = nOriginalStoredProcedure.GetTBL_SP_ReturnRows()[0];
                        var newSpReturn      = newDataBase.TBL_SP_Return.NewTBL_SP_ReturnRow();

                        newSpReturn.fk_Object            = newObject.id_Object;
                        newSpReturn.Return_Type          = originalSpReturn.Return_Type;
                        newSpReturn.Data_Type_Returned   = originalSpReturn.Data_Type_Returned;
                        newSpReturn.Schema_Name_Returned = originalSpReturn.Schema_Name_Returned;
                        newSpReturn.Object_Name_Returned = originalSpReturn.Object_Name_Returned;

                        newDataBase.TBL_SP_Return.AddTBL_SP_ReturnRow(newSpReturn);
                    }
                    catch { }

                    DBM.Connection_Close();

                    return(newObject);
                }

                throw new Exception("Se debe seleccionar una conexión");
            }
            catch (Exception ex)
            {
                if (DBM != null)
                {
                    DBM.Connection_Close();
                }
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 13
0
        public void LoadAndRefreshAllObjects(bool recursiveSelectedObjects, bool AddNewsOnly)
        {
            CMData.Manager.DBManager DBM = null;
            bool Cancel = false;

            try
            {
                if (Connection != null)
                {
                    Log = new StringBuilder();

                    if (Connection.IsConnection_TypeNull())
                    {
                        DBM = new CMData.Manager.DBManager(Connection.Connection_String);
                    }
                    else
                    {
                        var dbType = (CMData.DataBase.DataBaseType)(Enum.Parse(typeof(CMData.DataBase.DataBaseType), Connection.Connection_Type));
                        DBM = new CMData.Manager.DBManager(dbType, Connection.Connection_String);
                    }

                    DBM.Connection_Open();

                    // Guardar antigua configuracion actual para ser actualizada en los casos en los que sea posible
                    var newMapDataBase = new XsdDataBase();

                    if (ProgressProcessChanged != null)
                    {
                        ProgressProcessChanged("Descargando", 3, 0);
                    }

                    // Cargar lista de objetos
                    var Filtros = new List <string>();
                    foreach (CMData.Schemas.XsdDataBase.TBL_SchemaRow SchemaRow in MapDataBase.TBL_Schema)
                    {
                        if (SchemaRow.Maping_Schema)
                        {
                            Filtros.Add(SchemaRow.Schema_Name);
                        }
                    }

                    DBM.DataBase.FillDataBaseTables(newMapDataBase.TBL_Object, Connection, Filtros);
                    DBM.DataBase.FillDataBaseViews(newMapDataBase.TBL_Object, Connection, Filtros);
                    DBM.DataBase.FillDataBaseStoredProcedures(newMapDataBase.TBL_Object, Connection, Filtros);

                    //Eliminar objetos no utilizados
                    var deleteObjects = new List <XsdDataBase.TBL_ObjectRow>();

                    foreach (XsdDataBase.TBL_ObjectRow originalObject in MapDataBase.TBL_Object.Rows)
                    {
                        var existsObj = FindObjectRow(newMapDataBase, originalObject.Catalog_Name, originalObject.Schema_Name, originalObject.Object_Name);

                        if (existsObj == null)
                        {
                            if (originalObject.Generic_Type == "Table")
                            {
                                Log.AppendLine("La tabla " + originalObject.Object_Name + " no fue encontrada en la base de datos");
                            }
                            else if (originalObject.Generic_Type == "View")
                            {
                                Log.AppendLine("La vista " + originalObject.Object_Name + " no fue encontrada en la base de datos");
                            }
                            else
                            {
                                Log.AppendLine("El procedimiento almacenado " + originalObject.Object_Name + " no fue encontrado en la base de datos");
                            }

                            deleteObjects.Add(originalObject);
                        }
                    }

                    foreach (var deleteObject in deleteObjects)
                    {
                        deleteObject.Delete();
                    }

                    //Agregar nuevos objetos
                    foreach (XsdDataBase.TBL_ObjectRow newObject in newMapDataBase.TBL_Object.Rows)
                    {
                        var existsObj = FindObjectRow(MapDataBase, newObject.Catalog_Name, newObject.Schema_Name, newObject.Object_Name);

                        if (existsObj == null)
                        {
                            bool mapped = false;

                            try { mapped = newObject.Mapped; }
                            catch { }

                            MapDataBase.TBL_Object.AddTBL_ObjectRow(Connection.id_Connection, newObject.Generic_Type, newObject.Catalog_Name, newObject.Schema_Name, newObject.Object_Type, newObject.Object_Name, newObject.Selected, mapped);

                            if (newObject.Generic_Type == "Table")
                            {
                                Log.AppendLine("La tabla " + newObject.Object_Name + " ha sido agregado recientemente");
                            }
                            else if (newObject.Generic_Type == "View")
                            {
                                Log.AppendLine("La vista " + newObject.Object_Name + " ha sido agregado recientemente");
                            }
                            else
                            {
                                Log.AppendLine("El procedimiento almacenado " + newObject.Object_Name + " ha sido agregado recientemente");
                            }
                        }
                    }

                    // Se sale si solo se requiere cargar los nuevos
                    if (AddNewsOnly)
                    {
                        return;
                    }

                    if (ProgressActionChanged != null)
                    {
                        ProgressActionChanged("Leyendo estructura de tablas", MapDataBase.TBL_Object.Rows.Count, 0);
                    }

                    var newObjectRows = FindObjects(MapDataBase, Connection.id_Connection, "Table");

                    foreach (var newObject in newObjectRows)
                    {
                        //Restaurar la configuracion temporalmente guardada
                        if (newObject.Selected)
                        {
                            if (recursiveSelectedObjects)
                            {
                                var TempObject = newObject;
                                RefreshObjectTable(ref TempObject);
                                newObject.Mapped = true;
                            }
                            else
                            {
                                newObject.Mapped = false;
                            }
                        }

                        if (ProgressIncrementAction != null)
                        {
                            ProgressIncrementAction(ref Cancel);
                        }
                        if (Cancel)
                        {
                            throw new Exception("Cancelada por el usuario");
                        }
                    }

                    if (ProgressIncrementProcess != null)
                    {
                        ProgressIncrementProcess(ref Cancel);
                    }
                    if (Cancel)
                    {
                        throw new Exception("Cancelada por el usuario");
                    }

                    // Actualizar las vistas
                    newObjectRows = FindObjects(MapDataBase, Connection.id_Connection, "View");

                    if (ProgressActionChanged != null)
                    {
                        ProgressActionChanged("Leyendo Vistas", newObjectRows.Length, 0);
                    }

                    foreach (var newObject in newObjectRows)
                    {
                        //Restaurar la configuracion temporalmente guardada
                        if (newObject.Selected)
                        {
                            if (recursiveSelectedObjects)
                            {
                                var TempObject = newObject;
                                RefreshObjectTable(ref TempObject);
                                newObject.Mapped = true;
                            }
                            else
                            {
                                newObject.Mapped = false;
                            }
                        }

                        if (ProgressIncrementAction != null)
                        {
                            ProgressIncrementAction(ref Cancel);
                        }
                        if (Cancel)
                        {
                            throw new Exception("Cancelada por el usuario");
                        }
                    }

                    if (ProgressIncrementProcess != null)
                    {
                        ProgressIncrementProcess(ref Cancel);
                    }
                    if (Cancel)
                    {
                        throw new Exception("Cancelada por el usuario");
                    }

                    // Actualizar los procedimientos almacenados
                    var newSpRows = FindObjects(MapDataBase, Connection.id_Connection, "StoredProcedure");

                    if (ProgressActionChanged != null)
                    {
                        ProgressActionChanged("Leyendo Procedimientos", newSpRows.Length, 0);
                    }

                    foreach (var newObject in newSpRows)
                    {
                        if (newObject.Selected)
                        {
                            if (recursiveSelectedObjects)
                            {
                                var TempObject = newObject;
                                RefreshStoredProcedure(ref TempObject);
                                newObject.Mapped = true;
                            }
                            else
                            {
                                newObject.Mapped = false;
                            }
                        }

                        if (ProgressIncrementAction != null)
                        {
                            ProgressIncrementAction(ref Cancel);
                        }
                        if (Cancel)
                        {
                            throw new Exception("Cancelada por el usuario");
                        }
                    }

                    if (ProgressIncrementProcess != null)
                    {
                        ProgressIncrementProcess(ref Cancel);
                    }
                    if (Cancel)
                    {
                        throw new Exception("Cancelada por el usuario");
                    }

                    DBM.Connection_Close();
                }
                else
                {
                    throw new Exception("Debe seleccionar una conexión");
                }
            }
            catch (Exception ex)
            {
                if (DBM != null)
                {
                    DBM.Connection_Close();
                }

                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 14
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     XsdDataBase ds = new XsdDataBase();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Exemplo n.º 15
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     XsdDataBase ds = new XsdDataBase();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "TBL_SchemaDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Exemplo n.º 16
0
 public DataBaseClassWriter(XsdDataBase nDataBaseDataSet)
 {
     _DataBaseDataSet = nDataBaseDataSet;
 }
Exemplo n.º 17
0
        //public DataBaseMapper(XsdDataBase.TBL_ConnectionRow nConnection)
        //{
        //    _MapDataBase = new XsdDataBase();
        //    _Connection = nConnection;
        //}

        public DataBaseMapper(XsdDataBase nMapDataBase, XsdDataBase.TBL_ConnectionRow nConnection)
        {
            Log         = new StringBuilder();
            MapDataBase = nMapDataBase;
            Connection  = nConnection;
        }