I was wondering is there\'s any side effect to registering the container within itself
IContainer container; ContainerBuilder builder = new ContainerBuilder
You can use this extension method:
public static void RegisterSelf(this ContainerBuilder builder) { IContainer container = null; builder.Register(c => container).AsSelf().SingleInstance(); builder.RegisterBuildCallback(c => container = c); }
use it like this: builder.RegisterSelf();
builder.RegisterSelf();