Ejemplo n.º 1
0
        public ResafeDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <ResafeDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            ResafeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ResafeConsts.ConnectionStringName));

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