A suggestion for VContainer registering of the global message pipe
nexxogen opened this issue · 1 comments
nexxogen commented
Hello.
I don't want to report an issue, but give a suggestion instead.
The documentation on how to initialize a global message pipe in Unity with DI plugins seems not ideal. I would think that you'd want to initalize such a global service inside the composition root, rather than in some random class. For VContainer, I believe this could be a much cleaner way to do it, than what is suggested in the documentation.
protected override void Configure(IContainerBuilder builder)
{
var options = builder.RegisterMessagePipe();
builder.RegisterBuildCallback(c => GlobalMessagePipe.SetProvider(c.AsServiceProvider()));
}
This way, you don't have to inject IObjectResolver
anywhere in order to initialize the global message pipe. I think this should work no matter what.
neuecc commented
thanks, I've fiexed.