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

            CrmDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CrmConsts.ConnectionStringName));

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