Esempio n. 1
0
        public SampleDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <SampleDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            SampleDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SampleConsts.ConnectionStringName));

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