Exemple #1
0
        public TodoDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TodoDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            TodoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TodoConsts.ConnectionStringName));

            return(new TodoDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TodoDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TodoDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TodoDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }