Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

mapping business entity object to dataobject in data access layer

$
0
0
I'm trying to map the values from the reservation_ business entity object to the entity framework reservation data object.
The problem I have is that the values from my res object ain't mapping to the reservation object. so the returned reservtion object in the code below is returning null values.
heres my code..

public static Reservation Reservationmapping(Reservation_ res)
        {
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.ID, c => c.Ignore());
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.Video_ID, c => c.MapFrom(j => res.videoDetails.ID));
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.Video_Name, c => c.MapFrom(j => res.videoDetails.title));
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.Member_ID, c => c.MapFrom(j => res.memberDetails.ID));
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.Place_in_the_Queue, c => c.Ignore());
            Mapper.CreateMap<Reservation_, Reservation>().ForMember(m => m.Priority_Level, c => c.Ignore());
           
            Reservation addedReservation = Mapper.Map<Reservation_, Reservation>(res);

            return addedReservation;
        }



the method above supporse to return a populated Reservation object back to caller.

any ideas on this

ray

Viewing all articles
Browse latest Browse all 51036

Trending Articles