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

            DemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoConsts.ConnectionStringName));

            return(new DemoDbContext(builder.Options));
        }
Esempio n. 2
0
        public DemoDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <DemoDbContext>();
            var configuration = AppConfigurations.Get(
                WebContentDirectoryFinder.CalculateContentRootFolder(),
                addUserSecrets: true
                );

            DemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString("Default"));

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