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

            XNotifiDbContextConfigurer.Configure(builder, configuration.GetConnectionString(XNotifiConsts.ConnectionStringName));

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