示例#1
0
 public void ExecuteSqlResource(Type type, string scriptResourceNameFormat)
 {
     using (Log.InfoTraceMethodCallFormat("ExecuteSqlResource", "Executing [{0}] for [{1}]", scriptResourceNameFormat, type == null ? "(null)" : type.FullName))
     {
         _provider.ExecuteSqlResource(type, scriptResourceNameFormat);
     }
 }
示例#2
0
 public void Export(string file, string[] schemaModules, string[] ownerModules)
 {
     using (Log.InfoTraceMethodCallFormat("Export", "file=[{0}],schemaModules=[{1}],ownerModules=[{2}]", file, string.Join(";", schemaModules ?? new string[] { }), string.Join(";", ownerModules ?? new string[] { })))
         using (var subContainer = container.BeginLifetimeScope())
         {
             Exporter.ExportFromContext(subContainer.Resolve <IZetboxServerContext>(), file, schemaModules, ownerModules);
         }
 }
示例#3
0
        public void TableBaseMigration(SourceTable tbl, Converter[] converter, Join[] additional_joins)
        {
            // ------------------- Argument checks -------------------
            if (tbl == null)
            {
                throw new ArgumentNullException("tbl");
            }
            if (tbl.DestinationObjectClass == null)
            {
                Log.InfoFormat("Skipping base migration of unmapped table [{0}]", tbl.Name);
                return;
            }

            using (Log.InfoTraceMethodCallFormat("TableBaseMigration", "{0} to {1}", tbl.Name, tbl.DestinationObjectClass.Name))
            {
                // ------------------- Build columns -------------------
                var mappedColumns = tbl.SourceColumn
                                    .Where(c => c.DestinationProperty.Count > 0)
                                    .OrderBy(c => c.Name)
                                    .ToList();
                // Ref Cols
                var referringCols = mappedColumns.Where(c => c.References != null).ToList();

                // ------------------- Migrate -------------------
                if (referringCols.Count == 0 && (additional_joins == null || additional_joins.Length == 0))
                {
                    TableBaseSimpleMigration(tbl, converter, mappedColumns);
                }
                else
                {
                    TableBaseComplexMigration(tbl, converter, mappedColumns, referringCols, additional_joins);
                }
            }
        }
示例#4
0
        protected void Execute()
        {
            if (!_isInitialized)
            {
                Initialize();
            }
            else
            {
                throw new InvalidOperationException("Already executed");
            }

            using (Log.InfoTraceMethodCallFormat("Migration", "Executing migration for [{0}]", _name))
            {
                ExecuteCore(_applicationScope.Resolve <IZetboxServerContext>());
            }

            CreateReport();
        }