Exemple #1
0
        public PropertySystemDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PropertySystemDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true);

            PropertySystemDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoConsts.ConnectionStringPropertySystemDbContext));

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

                    //}
                });
            }
        }