public ChiMaDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <ChiMaDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); ChiMaDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ChiMaConsts.ConnectionStringName)); //ChiMaDbContextConfigurer.Configure(builder, "Server=localhost; Database=ChiMaDb; Trusted_Connection=True;"); //ChiMaDbContextConfigurer.Configure(builder, "Server=localhost;port=3306;database=ChiMaDb;uid=root;password=root;character set=utf8;Old Guids=true"); return(new ChiMaDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <ChiMaDbContext>(options => { if (options.ExistingConnection != null) { ChiMaDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { ChiMaDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } //options.DbContextOptions.UseLoggerFactory(MyLoggerFactory); }); } AddUnitOfWorkFilters(); }