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); } } }
private void InitializeSchemaMaping() { string MapFileName = ClassFileName + ".map"; if (File.Exists(MapFileName)) { this.SchemaMaping = SchemaMapingManager.Deserialize(MapFileName); } else { this.SchemaMaping = new SchemaMapingManager(); } }