コード例 #1
0
        public HinnovaDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <HinnovaDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true);

            HinnovaDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HinnovaConsts.ConnectionStringName));

            return(new HinnovaDbContext(builder.Options));
        }
コード例 #2
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <HinnovaDbContext>(options => {
                    if (options.ExistingConnection != null)
                    {
                        HinnovaDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        HinnovaDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }

            // Uncomment below line to write change logs for the entities below:
            // Because of https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4948, below configuration will not work
            // Just add [Audited] attribute to Entities you want to enabled EntityHistory for until ABP 4.11 is released.
            //Configuration.EntityHistory.Selectors.Add("HinnovaEntities", EntityHistoryHelper.TrackedTypes);
            //Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
        }