示例#1
0
        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;
                    }
                }
            }
        }
示例#2
0
文件: Program.cs 项目: 0anion0/IBN
        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();
        }
示例#3
0
文件: Program.cs 项目: 0anion0/IBN
        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;
                    }
                }
            }
        }
示例#4
0
        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);
        }