IwbApplicationModule.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Reflection;
  2. using Abp.Authorization;
  3. using Abp.AutoMapper;
  4. using Abp.Modules;
  5. using Abp.Notifications;
  6. using WeApp.BaseSystem.Notifications.Dto;
  7. using IwbZero.Authorization.Base.Permissions;
  8. namespace WeApp
  9. {
  10. [DependsOn(
  11. typeof(WeAppDataModule),
  12. typeof(AbpAutoMapperModule)
  13. )]
  14. public class WeAppApplicationModule : AbpModule
  15. {
  16. public override void PreInitialize()
  17. {
  18. }
  19. public override void Initialize()
  20. {
  21. IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
  22. // TODO: Is there somewhere else to store these, with the dto classes
  23. Configuration.Modules.AbpAutoMapper().Configurators.Add(cfg =>
  24. {
  25. // Role and permission
  26. cfg.CreateMap<Permission, string>().ConvertUsing(r => r.Name);
  27. cfg.CreateMap<PermissionSetting, string>().ConvertUsing(r => r.Name);
  28. cfg.CreateMap<NotificationDefinition, NotificationSubscriptionWithDisplayNameDto>();
  29. //cfg.CreateMap<BehaviorRoleInfo, BehaviorRoleDto>().ForMember(a=>a.SceneCategoryName,o=>o.MapFrom(a=>a.SceneCategoryInfo != null ? a.SceneCategoryInfo.CategoryName : ""));
  30. });
  31. }
  32. }
  33. }