Byte array conversion throw System.NotSupported Exception

6 views
Skip to first unread message

atul2...@gmail.com

unread,
Jul 6, 2016, 5:57:58 AM7/6/16
to AutoMapper-users

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

Reply all
Reply to author
Forward
0 new messages