Пример #1
0
        public TAXDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TAXDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true);

            TAXDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoConsts.ConnectionStringTAXDbContext));

            return(new TAXDbContext(builder.Options));
        }
Пример #2
0
        public override void PreInitialize()
        {
            Configuration.ReplaceService <IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient);
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <TAXDbContext>(options =>
                {
                    TAXDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    //if (options.ExistingConnection != null)
                    //{
                    //    NewCommDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    //}
                    //else
                    //{

                    //}
                });
            }
        }