Castle.MicroKernel.Handlers.DefaultGenericHandler.Resolve C# (CSharp) 메소드

Resolve() 보호된 메소드

protected Resolve ( CreationContext context, bool instanceRequired ) : object
context CreationContext
instanceRequired bool
리턴 object
		protected override object Resolve(CreationContext context, bool instanceRequired)
		{
			var implType = GetClosedImplementationType(context, instanceRequired);
			if (implType == null)
			{
				Debug.Assert(instanceRequired == false, "instanceRequired == false");
				return null;
			}

			var handler = GetSubHandler(implType, context.RequestedType);
			// so the generic version wouldn't be considered as well
			using (context.EnterResolutionContext(this, false, false))
			{
				try
				{
					return handler.Resolve(context);
				}
				catch (GenericHandlerTypeMismatchException e)
				{
					throw new HandlerException(
						string.Format(
							"Generic component {0} has some generic dependencies which were not successfully closed. This often happens when generic implementation has some additional generic constraints. See inner exception for more details.",
							ComponentModel.Name), ComponentModel.ComponentName, e);
				}
			}
		}