예제 #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);
             }
         });
     }
 }
        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);
                    }
                });
            }

            //Uncomment below line to write change logs for the entities below:
            //Configuration.EntityHistory.Selectors.Add("CRMEntities", typeof(OrganizationUnit), typeof(Role), typeof(Tenant));
        }