This is my code this is RealSaleMan Class:
[Table("RealSaleMan")]
public class RealSaleMan : FullAuditedEntity<Int64>
{
public string Name { get; set; }
public string Department { get; set; }
public string PhoneNumber { get; set; }
}
public class RealSaleManEditDto
{
public Int64? Id { get; set; }
public string Name { get; set; }
public string Department { get; set; }
public string PhoneNumber { get; set; }
}
I face the exception when doing mapto works in
var realSaleMan = input.RealSaleMan.MapTo<RealSaleMan>();
This is the exception: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters
RealSaleManEditDto -> RealSaleMan (Destination member list) Invincible.AIVoiceServiceDemo.RealMan.Dto.RealSaleManEditDto -> Invincible.AIVoiceServiceDemo.RealMan.RealSaleMan (Destination member list)
Unmapped properties: IsDeleted DeleterUserId DeletionTime LastModificationTime LastModifierUserId CreationTime CreatorUserId
those attributes are generated automaticly , it is boring for me to wirte those in my RealSaleManEditDto class. I tried one way it works temply but has a hiden technical probem. I let this RealSaleManEditDto inherits FullAuditedEntity<Int64> too, just as what I did in defining RealSaleMan class in core layer. like this :
public class RealSaleManEditDto:FullAuditedEntity<Int64>
{
public Int64? Id { get; set; }
public string Name { get; set; }
public string Department { get; set; }
public string PhoneNumber { get; set; }
}
CS0114 “RealSaleManEditDto.Id” hidenly inherits “Entity<long>.Id”。if you want to override,please add override。if not, please add new。 Please tell me what should I do here. Thanks!
1 Answer(s)
-
0
You need to create mappings:
[AutoMapFrom(typeof(RealSaleMan))] public class RealSaleManEditDto { // ... }
You can refer to ASP.NET Zero development guide on DTO Mappings.