Exemplo n.º 1
0
        public Assembly Load(MigrationsSource source, string filePath)
        {
            try
            {
                var assembly = Assembly.LoadFile(filePath);
                var rootPath = Path.GetDirectoryName(filePath);

                if (source == MigrationsSource.Target)
                {
                    m_TargetPath = rootPath;
                }
                else
                {
                    m_DeployedPath = rootPath;
                }

                m_Sources.TryAdd(BuildAssemblyId(assembly), source);
                return(assembly);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Unablet to load assembly from path {filePath}", filePath);
            }

            return(null);
        }
Exemplo n.º 2
0
 public MigrationInfo(
     MigrationsSource source,
     Assembly assembly,
     string configurationType,
     ContextKeySchemaInfo contextKeySchema,
     DbMigrator genericMigrator)
 {
     this.GenericMigrator   = genericMigrator;
     this.Assembly          = assembly;
     this.ConfigurationType = configurationType;
     this.ContextKeySchema  = contextKeySchema;
     this.Source            = source;
 }
 public MigrationInfo(
     MigrationsSource source, 
     Assembly assembly, 
     string configurationType, 
     ContextKeySchemaInfo contextKeySchema, 
     DbMigrator genericMigrator)
 {
     this.GenericMigrator = genericMigrator;
     this.Assembly = assembly;
     this.ConfigurationType = configurationType;
     this.ContextKeySchema = contextKeySchema;
     this.Source = source;
 }
Exemplo n.º 4
0
        private MigrationInfo GetMigrationInfo(MigrationsSource source)
        {
            var assembly = (source == MigrationsSource.Target)
                ? this.TargetAssembly
                : this.DeployedAssembly;

            if (assembly == null)
            {
                throw new InvalidOperationException("Source assembly could not be loaded");
            }

            var migrationConfigurationType = m_Config.MigrationConfig.Type;

            return(new MigrationInfo(
                       source,
                       assembly,
                       migrationConfigurationType,
                       GetContextKeySchema(assembly, migrationConfigurationType),
                       GetDbMigrator(assembly, migrationConfigurationType)));
        }
        public Assembly Load(MigrationsSource source, string filePath)
        {
            try
            {
                var assembly = Assembly.LoadFile(filePath);
                var rootPath = Path.GetDirectoryName(filePath);

                if (source == MigrationsSource.Target)
                {
                    m_TargetPath = rootPath;
                }
                else
                {
                    m_DeployedPath = rootPath;
                }
                    
                m_Sources.TryAdd(BuildAssemblyId(assembly), source);
                return assembly;
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Unablet to load assembly from path {filePath}", filePath);
            }

            return null;
        }
        private MigrationInfo GetMigrationInfo(MigrationsSource source)
        {
            var assembly = (source == MigrationsSource.Target)
                ? this.TargetAssembly 
                : this.DeployedAssembly;

            if (assembly == null)
            {
                throw new InvalidOperationException("Source assembly could not be loaded");
            }

            var migrationConfigurationType = m_Config.MigrationConfig.Type;
            return new MigrationInfo(
                source,
                assembly,
                migrationConfigurationType,
                GetContextKeySchema(assembly, migrationConfigurationType),
                GetDbMigrator(assembly, migrationConfigurationType));
        }