Example #1
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);
        }
Example #2
0
 public void RegisterType <T>(T instance)
 {
     CurrentNestedContainer.Configure(x => x.For <T>().AddInstance(new ObjectInstance(instance)));
 }