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

            FileManagementDbContextConfigurer.Configure(builder, configuration.GetConnectionString(FileManagementConsts.ConnectionStringName));

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

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