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

            QADbContextConfigurer.Configure(builder, configuration.GetConnectionString(QAConsts.ConnectionStringName));

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