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

            PreciseDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PreciseConsts.ConnectionStringName));

            return(new PreciseDbContext(builder.Options));
        }
Пример #2
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <PreciseDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        PreciseDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        PreciseDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }

            // Uncomment below line to write change logs for the entities below:
            //Configuration.EntityHistory.Selectors.Add("PreciseEntities", EntityHistoryHelper.TrackedTypes);
            //Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
        }