/// <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> /// Initializes a new instance of the <see cref="MvcApplicationContext"/> class. /// </summary> /// <param name="args">The args.</param> public MvcApplicationContext(MvcApplicationContextArgs args) : base(args.Name, args.CaseSensitive, args.ParentContext) { _configurationLocations = args.ConfigurationLocations; _configurationResources = args.ConfigurationResources; Refresh(); if (log.IsDebugEnabled) { log.Debug("created instance " + this.ToString()); } }
/// <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; } }
public MvcWebApplicationContext(MvcApplicationContextArgs args) : base(args) { }