static void UpdateMetaModel(string commandsFilePath) { LogFile.WriteLine("Updating metamodel..."); SchemaDocument schema = new SchemaDocument(); schema.Load(Path.Combine(Settings.InstallDir, @"Code\_Source\Tools\metamodelSchema.xml")); SyncCommand[] commands = McXmlSerializer.GetObjectFromFile <SyncCommand[]>(commandsFilePath); using (DataContext dataContext = new DataContext(string.Empty)) { DataContext.Current = dataContext; dataContext.SqlContext.CommandTimeout = CommandTimeout; SqlTransaction previousTransaction = DataContext.Current.SqlContext.Transaction; using (DBTransaction tran = DBHelper2.DBHelper.BeginTransaction()) { DataContext.Current.SqlContext.Transaction = tran.SqlTran; try { MetaModelSync.Execute(schema, commands); tran.Commit(); LogWriteOk(); } finally { DataContext.Current.SqlContext.Transaction = previousTransaction; } } } }
static void UpdateMetaModel(string companyRoot, string commandsFilePath) { LogFile.WriteLine("Updating metamodel..."); SchemaDocument schema = new SchemaDocument(); schema.Load(Path.Combine(companyRoot, @"Tools\metamodelSchema.xml")); SyncCommand[] commands = McXmlSerializer.GetObjectFromFile<SyncCommand[]>(commandsFilePath); MetaModelSync.Execute(schema, commands); LogWriteOk(); }
static void UpdateMetaModel(string commandsFilePath) { LogFile.WriteLine("Updating metamodel..."); SchemaDocument schema = new SchemaDocument(); schema.Load(Path.Combine(Settings.InstallDir, @"Code\_Source\Tools\metamodelSchema.xml")); SyncCommand[] commands = McXmlSerializer.GetObjectFromFile<SyncCommand[]>(commandsFilePath); using (DataContext dataContext = new DataContext(string.Empty)) { DataContext.Current = dataContext; dataContext.SqlContext.CommandTimeout = CommandTimeout; SqlTransaction previousTransaction = DataContext.Current.SqlContext.Transaction; using (DBTransaction tran = DBHelper2.DBHelper.BeginTransaction()) { DataContext.Current.SqlContext.Transaction = tran.SqlTran; try { MetaModelSync.Execute(schema, commands); tran.Commit(); LogWriteOk(); } finally { DataContext.Current.SqlContext.Transaction = previousTransaction; } } } }
private void CreateMetadata() { SchemaDocument schema = new SchemaDocument(); schema.Load(string.Concat(_toolsDir, "metamodelSchema.xml")); SyncCommand[] commands = McXmlSerializer.GetObjectFromFile<SyncCommand[]>(string.Concat(_toolsDir, "metamodelCommands.xml")); MetaModelSync.Execute(schema, commands); // Fill tables XmlDocument doc = new XmlDocument(); doc.Load(Path.Combine(_toolsDir, "metamodelData.xml")); WriteTables(doc.SelectNodes("/dictionaries/dictionary"), _dbHelper, 0, 0, null, true, null); }