示例#1
0
        public DbContext ReloadDbContext()
        {
            var migrationsAssembly = DbContextBuilder.BuildDbContextAssembly(DatasetName);

            this.DbContext = DbContextBuilder.GetDBContext(migrationsAssembly, $"Models.Contexts.{DatasetName}.Context", ob => ob.UseNpgsql(ConnectionString, o => o.MigrationsAssembly(migrationsAssembly.GetName().ToString())));
            return(DbContext);
        }
示例#2
0
        public DatabaseCreator(string connectionString, string datasetName, Assembly asm = null)
        {
            this.ConnectionString = connectionString;
            this.DatasetName      = datasetName;
            var dbContextAssembly = asm ?? DbContextBuilder.BuildDbContextAssembly(DatasetName);

            this.DbContext = DbContextBuilder.GetDBContext(dbContextAssembly, $"Models.Contexts.{DatasetName}.Context", ob => ob.UseNpgsql(ConnectionString));
        }