コード例 #1
0
        public PosDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PosDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            PosDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PosConsts.ConnectionStringName));

            return(new PosDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <PosDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 PosDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 PosDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }