Castle.MicroKernel.Context.CreationContext.EnterResolutionContext C# (CSharp) Method

EnterResolutionContext() public method

public EnterResolutionContext ( IHandler handlerBeingResolved, bool trackContext, bool requiresDecommission ) : ResolutionContext
handlerBeingResolved IHandler
trackContext bool
requiresDecommission bool
return ResolutionContext
		public ResolutionContext EnterResolutionContext(IHandler handlerBeingResolved, bool trackContext,
		                                                bool requiresDecommission)
		{
			var resolutionContext = new ResolutionContext(this, handlerBeingResolved, requiresDecommission, trackContext);
			handlerStack.Push(handlerBeingResolved);
			if (trackContext)
			{
				resolutionStack.Push(resolutionContext);
			}
			return resolutionContext;
		}

Same methods

CreationContext::EnterResolutionContext ( IHandler handlerBeingResolved, bool requiresDecommission ) : ResolutionContext

Usage Example

		protected override object ResolveCore(CreationContext context, bool track, bool instanceRequired)
		{
			Type implType;
			try
			{
				implType = ComponentModel.Implementation.MakeGenericType(context.GenericArguments);
			}
			catch (ArgumentException)
			{
				// may throw in some cases when impl has generic constraints that service hasn't
				if(instanceRequired)
				{
					throw;
				}
				return null;
			}

			var handler = GetSubHandler(context, implType);

			// so the generic version wouldn't be considered as well
			using(context.EnterResolutionContext(this, false))
			{
				return handler.Resolve(context);
			}
		}
All Usage Examples Of Castle.MicroKernel.Context.CreationContext::EnterResolutionContext