如何在ApplicationModule Initialize()方法中获取DBContext

时间:2019-03-03 05:16:46

标签: asp.net-core automapper aspnetboilerplate asp.net-boilerplate

我正在尝试为我的aspnet样板核心项目配置automapper.Collections,如何获取要配置的DBContext:

cfg.SetGeneratePropertyMaps>();

即在

   public override void Initialize()
    {
        var thisAssembly = typeof(ApplicationModule).GetAssembly();

        IocManager.RegisterAssemblyByConvention(thisAssembly);

        Configuration.Modules.AbpAutoMapper().Configurators.Add(
            // Scan the assembly for classes which inherit from AutoMapper.Profile
            cfg => {
                cfg.AddProfiles(thisAssembly);
                cfg.AddCollectionMappers();
                cfg.SetGeneratePropertyMaps<GenerateEntityFrameworkCorePrimaryKeyPropertyMaps<dbcontext>> ();
            }
        );
    }

0 个答案:

没有答案