예제 #1
0
        public WSDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <WSDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            WSDbContextConfigurer.Configure(builder, configuration.GetConnectionString(WSConsts.ConnectionStringName));

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