ValueInjecter地图复杂类型

时间:2016-01-28 14:56:24

标签: c# mapping valueinjecter

我试图使用ValueInjecter映射这些复杂类型,但映射对象的所有属性都为null。

DTO

public class HardwareSettingsDto
{
    public HardwareSettingsDto()
    {
        EmailAlertSettings = new EmailAlertSettingsDto();
        CpuMonitoring = new CpuMonitoringDto();
        NetworkMonitoring = new NetworkMonitoringDto();
    }

    // I wont include the below classes but they contain property types of int, string, bool etc.
    public CpuMonitoringDto CpuMonitoring { get; set; }
    public NetworkMonitoringDto NetworkMonitoring { get; set; }
    public List<DriveSettingsDto> Drives { get; set; }
    public EmailAlertSettingsDto EmailAlertSettings { get; set; }
}

实体

public class HardwareSettings
{
    public HardwareSettings()
    {
        EmailAlertSettings = new EmailAlertSettings();
        CpuMonitoring = new CpuMonitoring();
        NetworkMonitoring = new NetworkMonitoring();
    }

    public CpuMonitoring CpuMonitoring { get; set; }
    public NetworkMonitoring NetworkMonitoring { get; set; }
    public List<DriveSettings> Drives { get; set; }
    public EmailAlertSettings EmailAlertSettings { get; set; }
}

我似乎无法来回映射它们DTO - &gt;实体然后实体 - &gt; DTO因为一切都是空的。

0 个答案:

没有答案