Autofac Integration

I struggled a bit with the Autofac integration. I got it to work but I had to read up on the “advanced” features of Autofac before I was able to understand the solution.!searchin/particularsoftware/autofac|sort:relevance/particularsoftware/0K9iZzs_jNo/apYdEIa2DgAJ

I was wondering is there a better way and much simpler to pass my container builder into NSB? Also, do you have sample on how to integrate with other Container such the built provider in ASP.NET core?

In case you don’t need to inject IEndpointInstance in your services, passing an existing autofac container doesn’t require a workaround as described in the linked google group question. See our Autofac documentation for more details how to pass an existing container to NServiceBus.

Registering back the created IEndpointInstance is indeed a bit tricky but also highly depends on the used container. Some allow runtime registrations, some don’t. We support most major DI containers, maybe there’s another container which you would prefer: Dependency Injection • NServiceBus • Particular Docs

Currently we do not support integration with the built-in ASP.NET provider. As far as I understand, the built-in container only support Transient, Singleton and PerRequest scopes while NServiceBus requires the ability to define custom scopes. But it should be possible to share a container between ASP.NET and NSB in case this container supports both.