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

            FridgeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(FridgeConsts.ConnectionStringName));

            return(new FridgeDbContext(builder.Options));
        }
        public override void PreInitialize()
        {
            Configuration.UnitOfWork.IsolationLevel = IsolationLevel.ReadCommitted;

            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <FridgeDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        FridgeDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        FridgeDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }
        }