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

            SmartMEDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SmartMEConsts.ConnectionStringName));

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