Update EmailContext mapping to ignore Sender property
The `EmailMappingProfile` class was updated to modify the mapping configuration between `SendEmailCommand` and `EmailContext`. A `.ForMember` configuration was added to explicitly ignore the `Sender` property in the destination (`EmailContext`) during the mapping process. This ensures that `Sender` is not mapped from the source object and must be set separately.
This commit is contained in:
@@ -13,6 +13,7 @@ public class EmailMappingProfile : Profile
|
|||||||
{
|
{
|
||||||
// SendEmailCommand -> Email
|
// SendEmailCommand -> Email
|
||||||
// Sender is resolved via MediatR in the handler and set separately after mapping.
|
// Sender is resolved via MediatR in the handler and set separately after mapping.
|
||||||
CreateMap<SendEmailCommand, EmailContext>();
|
CreateMap<SendEmailCommand, EmailContext>()
|
||||||
|
.ForMember(dest => dest.Sender, opt => opt.Ignore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user