public void DisposeNestedContainer()
 {
     if (CurrentNestedContainer != null)
     {
         CurrentNestedContainer.Dispose();
         CurrentNestedContainer = null;
     }
 }
Beispiel #2
0
        /// <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;
     }
 }
Beispiel #4
0
 public void Dispose()
 {
     CurrentNestedContainer?.Dispose();
     Container?.Dispose();
 }
Beispiel #5
0
 public void RegisterType <T>(T instance)
 {
     CurrentNestedContainer.Configure(x => x.For <T>().AddInstance(new ObjectInstance(instance)));
 }