十进制属性的映射问题

时间:2018-01-21 14:25:35

标签: c# .net mapping decimal automapper

我有一个类ABC,其属性amount的类型为decimal,我的ABCdto也有一个十进制属性amount

现在我正在进行从ABCABDdto的映射,但我遇到了这个问题:

  

映射类型:

     

SubscriptionConfigurationTransaction - >十进制   CommPlat.Core.Domain.Aggregates.SubscriptionConfigurationTransactionAgg.SubscriptionConfigurationTransaction    - > System.Decimal

     

目的地路径:   SubscriptionConfigurationTransactionDto.SubscriberBalanceAfterTransaction.SubscriberBalanceAfterTransaction

     

来源价值:   CommPlat.Core.Domain.Aggregates.SubscriptionConfigurationTransactionAgg.SubscriptionConfigurationTransaction

请注意,SubscriberBalanceAfterTransaction是十进制的,我不确定为什么显示SubscriberBalanceAfterTransaction.SubscriberBalanceAfterTransaction

相关代码:

public class SubscriptionConfigurationTransaction
{
   public decimal balance {get {return subscriber.balance;}}
   public decimal amount {get { subscription.amount}}
   public decimal SubscriberBalanceAfterTransaction {get {return balance - amount;}}
}

public class SubscriptionConfigurationTransactionDto
{
   public decimal SubscriberBalanceAfterTransaction {get; set;}
}

在全球范围内我正在添加此

Mapper.CreateMap<SubscriberBalanceAfterTransaction, SubscriptionConfigurationTransactionDto>()

0 个答案:

没有答案