我有一个类ABC
,其属性amount
的类型为decimal
,我的ABCdto
也有一个十进制属性amount
现在我正在进行从ABC
到ABDdto
的映射,但我遇到了这个问题:
映射类型:
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>()