i have entity class, pinjaman_DataEntities
, that has 4 properties.
public string appl_no { get; set; }
public string reff_number { get; set; }
public string cust_name { get; set; }
public string merchant_id { get; set; }
and i have a database context gt_applikasi_pinjaman
that has more properties than pinjaman_DataEntities
, but still have same name of 4 properties above.
and i want to map from pinjaman_DataEntities
to gt_appllikasi_pinjaman
and this codes below :
public bool updateFilter(pinjaman_DataEntities filterPinjaman)
{
bool valid = true;
filterPinjaman = (pinjaman_DataEntities)ConvertDataEmpetyStringToNull(filterPinjaman);
gt_applikasi_pinjaman pinjaman = dbContext.gt_applikasi_pinjaman.Find(filterPinjaman.appl_no);
Mapper.CreateMap<pinjaman_DataEntities, gt_applikasi_pinjaman>()
.ForAllMembers(opt => opt.Condition(srs => !srs.IsSourceValueNull));
Mapper.Map(filterPinjaman, pinjaman);
dbContext.Entry(pinjaman).State = EntityState.Modified;
dbContext.SaveChanges();
return valid;
}
after i run the code, i have error when the code was on
Mapper.Map(filterPinjaman, pinjaman);
And the error message is :
An exception of type 'System.Exception' occurred in WebApplicationServiceAPIA.dll but was not handled in user code
Additional information:
Mapping types:
pinjaman_DataEntities -> Nullable`1
ServiceAPIA.DataEntities.pinjaman_DataEntities -> System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Destination path: gt_applikasi_pinjaman.appl_date.appl_date
Source value: ServiceAPIA.DataEntities.pinjaman_DataEntities
What's that mean, and how to fix it? Lot of thanks.