public TrackingSystemDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <TrackingSystemDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); TrackingSystemDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TrackingSystemConsts.ConnectionStringName)); return(new TrackingSystemDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <TrackingSystemDbContext>(options => { if (options.ExistingConnection != null) { TrackingSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { TrackingSystemDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }