public TodoModuleDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TodoModuleDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            DbContextOptionsConfigurer.Configure(
                builder,
                configuration.GetConnectionString(TodoModuleCoreConsts.ConnectionStringName)
                );

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