Steps:
- Receive ViewModel to update or create entity
- Attempt to get existing entity if it exists
- Call
IMapper.map(viewModel, entity)
Because I'm providing a destination value to the map, is it possible to check that destination value for PreConditions?
Something like
.ForMember(x => x.Id, opt => {
opt.PreCondition((src, desintation) => destination.Id == null);
opt.MapFrom(src => Guid.NewGuid());
}
Is that possible? Maybe there's a better approach?