Пример #1
0
        public YDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <YDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            YDbContextConfigurer.Configure(builder, configuration.GetConnectionString(YConsts.ConnectionStringName));

            return(new YDbContext(builder.Options));
        }
Пример #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <YDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 YDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 YDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }