Encapsulates arguments to the Spring.Context.Support.MvcApplicationContext class.
Inheritance: Spring.Context.Support.AbstractXmlApplicationContextArgs
コード例 #1
0
        /// <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());
            }
        }
コード例 #3
0
        /// <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());
            }
        }
コード例 #4
0
        /// <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;
            }
        }
コード例 #5
0
 public MvcWebApplicationContext(MvcApplicationContextArgs args)
     : base(args)
 {
 }