Beispiel #1
0
        public SolutionDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <SolutionDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            SolutionDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SolutionConsts.ConnectionStringName));

            return(new SolutionDbContext(builder.Options));
        }
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <SolutionDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        SolutionDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        SolutionDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }

            Configuration.UnitOfWork.IsolationLevel = IsolationLevel.ReadCommitted;
        }