i'm using automapper in C# i'm facing an issue in it.
when i get list of objects from database it's fine.
but when i map it to another class then the Id property which is a primery key becomes 0 of all the list objects
*Every thing is fine till here*
var customers = _context.Customers.ToList();
* After this mapping*
var customerList = Mapper.Map<IEnumerable<Customer>, IEnumerable<CustomerDto>>(customers);
* This customerList has all the data except the Id property which becomes 0*
Why i'm facing this issue ? how can i fix it ?My both class are below
public class Customer { public int Id { get; set; } public string Name { get; set; } public bool IsSubscribedToNewsLetter { get; set; } public MembershipType MembershipType { get; set; } } public class CustomerDto { public int Id { get; set; } public string Name { get; set; } }