Files
DMS/DMS.Application/Profiles/MappingProfile.cs
David P.G 816827e5e9 refactor: 移除MenuBeanDto,直接使用MenuBean模型
- 删除了 DMS.Application/DTOs/MenuBeanDto.cs 文件
- 在DTOs中将MenuBeanDto类型替换为MenuBean类型
- 更新了IMenuAppService和IMenuManagementService接口中相关方法的参数和返回值类型
- 修改了MenuAppService、MenuManagementService等服务类的实现
- 在DMS.Core/Models/MenuBean.cs中添加了Children属性以支持菜单树结构
- 更新了WPF层相关的菜单处理逻辑
- 修改了映射配置和视图模型中的菜单对象创建方式
- 这一更改简化了数据模型,消除了DTO与模型之间的重复定义,直接在各层之间使用MenuBean实体。
2025-10-13 20:20:09 +08:00

48 lines
1.5 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using AutoMapper;
using DMS.Application.DTOs;
using DMS.Core.Models;
using DMS.Core.Models.Triggers;
namespace DMS.Application.Profiles;
/// <summary>
/// é…<C3A9>ç½®AutoMapper的映射规则ã€?/// </summary>
public class MappingProfile : Profile
{
public MappingProfile()
{
// Variable 映射
// VariableHistory 映射
CreateMap<VariableHistory, VariableHistoryDto>()
.ForMember(dest => dest.VariableName, opt => opt.MapFrom(src => src.Variable.Name))
.ReverseMap();
// User 映射
CreateMap<User, UserDto>().ReverseMap();
CreateMap<Nlog, NlogDto>().ReverseMap();
// 邮件相关映射
CreateMap<EmailAccount, EmailAccountDto>().ReverseMap();
CreateMap<EmailAccount, CreateEmailAccountRequest>().ReverseMap();
CreateMap<EmailMessage, EmailMessageDto>().ReverseMap();
CreateMap<EmailMessage, SendEmailRequest>()
.ForMember(dest => dest.EmailAccountId, opt => opt.MapFrom(src => src.EmailAccountId))
.ReverseMap();
CreateMap<EmailTemplate, EmailTemplateDto>().ReverseMap();
CreateMap<EmailLog, EmailLogDto>().ReverseMap();
CreateMap<TriggerDefinition, TriggerDefinitionDto>()
.ForMember(dest => dest.VariableIds, opt => opt.MapFrom(src => src.VariableIds))
.ReverseMap()
.ForMember(dest => dest.VariableIds, opt => opt.MapFrom(src => src.VariableIds));
}
}