first commit
This commit is contained in:
17
src/GreenHome.Application/MappingProfile.cs
Normal file
17
src/GreenHome.Application/MappingProfile.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
|
||||
namespace GreenHome.Application;
|
||||
|
||||
// Mapping profile
|
||||
public sealed class MappingProfile : Profile
|
||||
{
|
||||
public MappingProfile()
|
||||
{
|
||||
CreateMap<Domain.Device, DeviceDto>().ReverseMap();
|
||||
CreateMap<Domain.TelemetryRecord, TelemetryDto>().ReverseMap();
|
||||
CreateMap<Domain.DeviceSettings, DeviceSettingsDto>()
|
||||
.ForMember(dest => dest.DeviceName, opt => opt.MapFrom(src => src.Device.DeviceName))
|
||||
.ReverseMap()
|
||||
.ForMember(dest => dest.Device, opt => opt.Ignore());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user