I use MassTransit package into my project (clean Architecture).
In API-layer I write custom authorization filter and in HttpContext exist my CurrentUserInfo data.
then I Need UserInfo inside the Application Layer where IConsumer exist like Code below.
Now which way is better to do:
- add metadata into my request client?
- declare general class and inject it into implemented IConsumer class.
public class OptionCreateConsumer : IConsumer<OptionCreateRequest>
{
private readonly IMapper _mapper;
private readonly IUnitOfWork _unitOfWork;
public OptionCreateConsumer(IMapper mapper, IUnitOfWork unitOfWork)
{
_mapper = mapper;
_unitOfWork = unitOfWork;
}
}