public void DisposeNestedContainer() { if (CurrentNestedContainer != null) { CurrentNestedContainer.Dispose(); CurrentNestedContainer = null; } }
/// <summary> /// The begin scope. /// </summary> /// <returns> /// The System.Web.Http.Dependencies.IDependencyScope. /// </returns> public IDependencyScope BeginScope() { var resolver = new StructureMapWebApiDependencyResolver(CurrentNestedContainer); ServiceLocatorProvider provider = () => resolver; CurrentNestedContainer.Configure(cfg => cfg.For <ServiceLocatorProvider>().Use(provider)); return(resolver); }
public void DisposeNestedContainer() { if (HttpContext == null) { return; } if (CurrentNestedContainer != null) { CurrentNestedContainer.Dispose(); CurrentNestedContainer = null; } }
public void Dispose() { CurrentNestedContainer?.Dispose(); Container?.Dispose(); }
public void RegisterType <T>(T instance) { CurrentNestedContainer.Configure(x => x.For <T>().AddInstance(new ObjectInstance(instance))); }