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

            AFXDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AFXConsts.ConnectionStringName));

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