コード例 #1
0
        /// <summary>
        ///   Resolves the component(s) from given kernel.
        /// </summary>
        /// <param name = "kernel"></param>
        /// <param name = "scope"></param>
        /// <returns>Resolved component(s).</returns>
        public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
        {
            if (LoadByName(kernel))
            {
                try
                {
                    return(kernel.Resolve(componentName, componentType, additionalArguments, scope));
                }
                catch (ComponentNotFoundException e)
                {
                    if (actualSelectorType == typeof(DefaultDelegateComponentSelector) && fallbackToResolveByTypeIfNameNotFound == false)
                    {
                        e.Data["breakingChangeId"] = "typedFactoryFallbackToResolveByTypeIfNameNotFound";
                        e.Data["breakingChange"]   = "This exception may have been caused by a breaking change between Windsor 2.5 and 3.0 See breakingchanges.txt for more details.";
                    }
                    throw;
                }
            }

            // Ignore thread-static parent context call stack tracking. Factory-resolved components
            // are already tracked by the factory itself and should not be added as burdens just because
            // we happen to be resolving in the call stack of some random component’s constructor.

            // Specifically, act the same as we would if the timing was slightly different and we were not
            // resolving within the call stack of the random component’s constructor.
            return(kernel.Resolve(componentType, additionalArguments, scope, ignoreParentContext: true));
        }
コード例 #2
0
		/// <summary>
		///   Resolves the component(s) from given kernel.
		/// </summary>
		/// <param name = "kernel"></param>
		/// <param name = "scope"></param>
		/// <returns>Resolved component(s).</returns>
		public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
		{
			if (ComponentName != null && kernel.LoadHandlerByKey(ComponentName, ComponentType, AdditionalArguments) != null)
			{
				return kernel.Resolve(ComponentName, ComponentType, AdditionalArguments, scope);
			}
			return kernel.Resolve(ComponentType, AdditionalArguments, scope);
		}
コード例 #3
0
 /// <summary>
 ///   Resolves the component(s) from given kernel.
 /// </summary>
 /// <param name = "kernel"></param>
 /// <param name = "scope"></param>
 /// <returns>Resolved component(s).</returns>
 public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
 {
     if (LoadByName(kernel))
     {
         return(kernel.Resolve(componentName, componentType, additionalArguments, scope));
     }
     return(kernel.Resolve(componentType, additionalArguments, scope));
 }
コード例 #4
0
		/// <summary>
		///   Resolves the component(s) from given kernel.
		/// </summary>
		/// <param name = "kernel"></param>
		/// <param name = "scope"></param>
		/// <returns>Resolved component(s).</returns>
		public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
		{
			if (LoadByName(kernel))
			{
				return kernel.Resolve(componentName, componentType, additionalArguments, scope);
			}
			return kernel.Resolve(componentType, additionalArguments, scope);
		}
コード例 #5
0
 /// <summary>
 ///   Resolves the component(s) from given kernel.
 /// </summary>
 /// <param name = "kernel"></param>
 /// <param name = "scope"></param>
 /// <returns>Resolved component(s).</returns>
 public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
 {
     if (ComponentName != null && kernel.LoadHandlerByKey(ComponentName, ComponentType, AdditionalArguments) != null)
     {
         return(kernel.Resolve(ComponentName, ComponentType, AdditionalArguments, scope));
     }
     return(kernel.Resolve(ComponentType, AdditionalArguments, scope));
 }
コード例 #6
0
		/// <summary>
		///   Resolves the component(s) from given kernel.
		/// </summary>
		/// <param name = "kernel"></param>
		/// <param name = "scope"></param>
		/// <returns>Resolved component(s).</returns>
		public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
		{
			if (kernel.HasComponent(ComponentName) == false)
			{
				return kernel.Resolve(ComponentType, AdditionalArguments, scope);
			}

			return kernel.Resolve(ComponentName, ComponentType, AdditionalArguments, scope);
		}
コード例 #7
0
 public WcfClientActivator(ComponentModel model, IKernelInternal kernel,
                           ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction)
     : base(model, kernel, onCreation, onDestruction)
 {
     clients      = kernel.Resolve <WcfClientExtension>();
     proxyFactory = new WcfProxyFactory(clients.ProxyGenerator, clients);
 }
コード例 #8
0
 public object Resolve(Type serviceType)
 {
     if (_kernel.LoadHandlerByType(null, serviceType, null) != null)
     {
         return(_kernel.Resolve(serviceType));
     }
     return(null);
 }
コード例 #9
0
 public object GetService(Type serviceType)
 {
     if (kernel.LoadHandlerByType(null, serviceType, null) == null)
     {
         return(kernel.Resolve(serviceType));
     }
     return(null);
 }
コード例 #10
0
		/// <summary>
		///   Resolves the component(s) from given kernel.
		/// </summary>
		/// <param name = "kernel"></param>
		/// <param name = "scope"></param>
		/// <returns>Resolved component(s).</returns>
		public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
		{
			if (LoadByName(kernel))
			{
				try
				{
					return kernel.Resolve(componentName, componentType, additionalArguments, scope);
				}
				catch (ComponentNotFoundException e)
				{
					if (actualSelectorType == typeof(DefaultDelegateComponentSelector) && fallbackToResolveByTypeIfNameNotFound == false)
					{
						e.Data["breakingChangeId"] = "typedFactoryFallbackToResolveByTypeIfNameNotFound";
						e.Data["breakingChange"] = "This exception may have been caused by a breaking change between Windsor 2.5 and 3.0 See breakingchanges.txt for more details.";
					}
					throw;
				}
			}
			return kernel.Resolve(componentType, additionalArguments, scope);
		}
コード例 #11
0
 /// <summary>
 ///   Resolves the component(s) from given kernel.
 /// </summary>
 /// <param name = "kernel"></param>
 /// <param name = "scope"></param>
 /// <returns>Resolved component(s).</returns>
 public virtual object Resolve(IKernelInternal kernel, IReleasePolicy scope)
 {
     if (LoadByName(kernel))
     {
         try
         {
             return(kernel.Resolve(componentName, componentType, additionalArguments, scope));
         }
         catch (ComponentNotFoundException e)
         {
             if (actualSelectorType == typeof(DefaultDelegateComponentSelector) && fallbackToResolveByTypeIfNameNotFound == false)
             {
                 e.Data["breakingChangeId"] = "typedFactoryFallbackToResolveByTypeIfNameNotFound";
                 e.Data["breakingChange"]   = "This exception may have been caused by a breaking change between Windsor 2.5 and 3.0 See breakingchanges.txt for more details.";
             }
             throw;
         }
     }
     return(kernel.Resolve(componentType, additionalArguments, scope));
 }
コード例 #12
0
            protected override IDictionary GetArguments(MethodInfo method, object[] arguments)
            {
                var generics = method.GetGenericArguments();

                if (generics.Length != 2 || generics.First() != typeof(IUnitOfWork) || !method.Name.Equals("create", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(base.GetArguments(method, arguments));
                }
                var uow = new Arguments
                {
                    { "session", _kernel.Resolve(generics.Last()) },
                    { "isolationLevel", arguments[0] },
                    { "sessionOnlyForThisUnitOfWork", true }
                };

                return(uow);
            }
コード例 #13
0
        public override object Resolve(IKernelInternal kernel, IReleasePolicy scope)
        {
            var manager = kernel.Resolve <WindsorDependencyResolver>().Resolve <IConnectionManager>();

            return(manager.GetHubContext(additionalArguments["hubname"].ToString()));
        }