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

            AzSMDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AzSMConsts.ConnectionStringName));

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