public MyEmployeeDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <MyEmployeeDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            MyEmployeeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyEmployeeConsts.ConnectionStringName));

            return(new MyEmployeeDbContext(builder.Options));
        }
Beispiel #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <MyEmployeeDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 MyEmployeeDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 MyEmployeeDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }