Today I have ran into an issue which I haven't been able to solve for the past hours. I have created a GitHub Gist here which shows my code. The error that AutoMapper has been returning is the following:
Missing type map configuration or unsupported mapping.
Mapping types:
Object -> Order
System.Object -> Rig.Commercial.Reservation.DataStorage.Entities.Order
Can someone help me out?
CodePudding user response:
It looks like the way you constructed your Profile class is wrong. That is BookingsMappers
class in your code.
According to the documentation here. The fix might be replacing your BookingsMappers
class to like this:
public class BookingsMappers : Profile
{
public BookingsMappers()
{
CreateMap<CreateBooking, Order>()
.BeforeMap((createBooking, order) => order.Created = DateTime.Now)
.BeforeMap((createBooking, order) => order.Modified = DateTime.Now)
.BeforeMap((createBooking, order) => order.InternalId = Guid.NewGuid());
}
}