WePlatformApplicationModule.cs 1.3 KB

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