コード例 #1
0
        public MindfightsDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <MindfightsDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            MindfightsDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MindfightsConsts.ConnectionStringName));

            return(new MindfightsDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <MindfightsDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 MindfightsDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 MindfightsDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }