Converting id's to entities
I have this kind of request:
BookRequest(
string name,
string description,
ICollection<long> authorIds)
I want to map it to an entity.
I consider there approaches:
1) Map it partially (name, description), then in a handler find the authors associated with passed authorIds and populate the entity Authors collection with them
2) Inject DB context into Mapper profile instance (Is it SOLID? Somebody said that it is not, but I feel like it is pretty ok)
3) Implement id->entity converter class to retrieve Authors by Ids and use it in the mapper.
Which do you consider the best? What are the other options?
BookRequest(
string name,
string description,
ICollection<long> authorIds)
I want to map it to an entity.
I consider there approaches:
1) Map it partially (name, description), then in a handler find the authors associated with passed authorIds and populate the entity Authors collection with them
2) Inject DB context into Mapper profile instance (Is it SOLID? Somebody said that it is not, but I feel like it is pretty ok)
3) Implement id->entity converter class to retrieve Authors by Ids and use it in the mapper.
Which do you consider the best? What are the other options?