public IScopedContainer CreateScope() { var childContainer = unity.CreateChildContainer(); var extensions = new UnityContainerExtension(childContainer); var scope = new ScopedContainer(extensions, childContainer); extensions.RegisterInstance <IScopedContainer>(scope); extensions.RegisterInstance <IContainerExtension>(scope); extensions.RegisterInstance <IContainerProvider>(scope); extensions.RegisterInstance <IContainerRegistry>(scope); return(scope); }
protected override IContainerExtension CreateContainerExtension() { var unity = new UnityContainer().AddExtension(new Diagnostic()); var container = new UnityContainerExtension(unity); var mainScope = new ScopedContainer(container, unity); container.RegisterInstance <IScopedContainer>(mainScope); return(container); }
protected override IContainerExtension CreateContainerExtension() { IUnityContainer unity = new UnityContainer(); #if DEBUG unity = unity.AddExtension(new Diagnostic()); #endif var container = new UnityContainerExtension(unity); var mainScope = new ScopedContainer(container, unity); container.RegisterInstance <IScopedContainer>(mainScope); ViewBind.ContainerProvider = container; return(container); }