/// <summary> /// /// </summary> /// <returns>The initialized <see cref="IDependencyScope"/> instance.</returns> /// <exception cref="NotImplementedException"></exception> public virtual IDependencyScope BeginScope() { if (HasApplicationContext && (HasChildApplicationContextConfigurationLocations || HasChildApplicationContextConfigurationResources)) { string[] configurationLocations = null; if (HasChildApplicationContextConfigurationLocations) { configurationLocations = ChildApplicationContextConfigurationLocations.ToArray(); } IResource[] configurationResources = null; if (HasChildApplicationContextConfigurationResources) { configurationResources = ChildApplicationContextConfigurationResources.ToArray(); } var childContextName = string.Format("child_of_{0}", ApplicationContext.Name); var args = new MvcApplicationContextArgs(childContextName, ApplicationContext, configurationLocations, configurationResources, false); var childContext = new MvcApplicationContext(args); var newResolver = new SpringWebApiDependencyResolver(childContext) { ApplicationContextName = childContextName }; RegisterContextIfNeeded(childContext); return(newResolver); } else { return(this); } }
/// <summary> /// /// </summary> /// <returns>The initialized <see cref="IDependencyScope"/> instance.</returns> /// <exception cref="NotImplementedException"></exception> public virtual IDependencyScope BeginScope() { var abstractXmlApplicationContext = ApplicationContext as AbstractXmlApplicationContext; if (abstractXmlApplicationContext != null) { var locations = abstractXmlApplicationContext.ConfigurationLocations; var resources = abstractXmlApplicationContext.ConfigurationResources; var args = new MvcApplicationContextArgs(string.Format("child_of_{0}", ApplicationContext.Name), ApplicationContext, locations, resources, false); var newResolver = new SpringWebApiDependencyResolver(new MvcApplicationContext(args)); return(newResolver); } else { return(this); } }