I'm looking at writing a middleware for Masstransit for when consuming messages, but I'm unsure how to inject a dependency into the middleware from the dependency injection container (scoped). I have the middleware working to read the headers, etc, but i'm just not sure how to inject a dependency. I've read numerous other issues but it's still not clear how to achieve this. Is there any guidance on this that I could look at or maybe an example?
For reference, this is a .NET 3.1 application using Masstransit v7 with the house of box DI container on top of Azure Service Bus (using MassTransit.AzureServiceBus package.
Would appreciate any guidance!