This is my Entity:
public class CouponEntity
{
public int CouponId { get; set; }
public int CompanyNumber { get; set; }
public string Name { get; set; }
public string FileName { get; set; }
public string CompanySlug
{
get
{
return COMMONCONSTANTS.URL_COMPANY + "/" + this.CompanyNumber;
}
}
}
And the following is my DTO:
public class CouponDto
{
[DataMember]
public string CompanySlug { get; set; }
[DataMember]
public string FileName { get; set; }
[DataMember]
public string Name { get; set; }
}
My question is: does using Mapper.Map<IEnumerable<CouponEntity>, IEnumerable<CouponDto>>(lstProducts) greatly affect performance?
I got the following from the AutoMapper creator somewhere on the Internet:
DTO is a strict projection of the data model. No business logic in mapping 99% "Auto" - restrict customization to minimum Prefer LINQ projection
So, is this what should be avoided? Is there a better way to accomplish this?