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

            PenSoftAPIDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PenSoftAPIConsts.ConnectionStringName));

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