public QiProcureDemoDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <QiProcureDemoDbContext>();
            var configuration = AppConfigurations.Get(
                WebContentDirectoryFinder.CalculateContentRootFolder(),
                addUserSecrets: true
                );

            QiProcureDemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(QiProcureDemoConsts.ConnectionStringName));

            return(new QiProcureDemoDbContext(builder.Options));
        }
예제 #2
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <QiProcureDemoDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        QiProcureDemoDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        QiProcureDemoDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }

            // Set this setting to true for enabling entity history.
            Configuration.EntityHistory.IsEnabled = false;

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