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

            builder.EnableSensitiveDataLogging();
            builder.EnableDetailedErrors();

            JewelleryDbContextConfigurer.Configure(builder, configuration.GetConnectionString(JewelleryConsts.ConnectionStringName));

            return(new JewelleryDbContext(builder.Options));
        }
Exemple #2
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <JewelleryDbContext>(options =>
                {
                    options.DbContextOptions.EnableDetailedErrors();
                    options.DbContextOptions.EnableSensitiveDataLogging();

                    if (options.ExistingConnection != null)
                    {
                        JewelleryDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        JewelleryDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }
        }