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

            InvoicingDbContextConfigurer.Configure(builder, configuration.GetConnectionString(InvoicingConsts.ConnectionStringName));

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