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

            CargoXDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CargoXConsts.ConnectionStringName));

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

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