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

            Vishnu_MyProjectDbContextConfigurer.Configure(builder, configuration.GetConnectionString(Vishnu_MyProjectConsts.ConnectionStringName));

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