In Entityframework code first I have classes with timestamp field to maintain coincurrency when I am trying to retrieve data without AuotMapper mapping it work fibe but when I try to use mapping then it produce System.NotSupported Exception in my output window. My mapping code is below
Mapper.Initialize(cfg =>
{
cfg.CreateMap<ClientPhone, ClientPhoneViewModel>();
cfg.CreateMap<ClientRecord, ClientRecordViewModel>();
});
Mapper.Map<ClientPhone, ClientPhoneViewModel>(new ClientPhone());
Mapper.Map<ClientRecord, ClientRecordViewModel>(new ClientRecord());
//My viewmodel classess
public abstract class BaseViewModel
{
public int Id { get; set; }
public byte[] RowVersion { get; set; }
}
public class ClientRecordViewModel : BaseViewModel
{
public string Name { get; set; }
public string Address { get; set; }
public ICollection<ClientPhoneViewModel> ClientPhones { get; set; }
}
public class ClientPhoneViewModel:BaseViewModel
{
public string ClientRecordName { get; set; }
public string PhoneNumberNumber { get; set; }
public int ClientRecordId { get; set; }
public int PhoneNumberId { get; set; }
}
my query to access it which throws an exception
` sdUow.ClientRecords.GetAll().ProjectTo<ClientRecordViewModel>().ToList();`
If i remove RowVersion from baseviewmodel it works then