コード例 #1
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <MetroStationDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        MetroStationDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        MetroStationDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });

                Configuration.Modules.AbpEfCore().AddDbContext <AuditLogDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        AuditLogDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        AuditLogDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }
        }
コード例 #2
0
        public AuditLogDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <AuditLogDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            AuditLogDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MetroStationConsts.AuditLogConnectionStringName));

            return(new AuditLogDbContext(builder.Options));
        }