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