コード例 #1
0
ファイル: ExtendedHandler.cs プロジェクト: dohansen/Windsor
		private void InvokeReleasePipeline(int extensionIndex, ReleaseInvocation invocation)
		{
			if (extensionIndex >= releaseExtensions.Length)
			{
				invocation.ReturnValue = base.Release(invocation.Burden);
				return;
			}
			var nextIndex = extensionIndex + 1;
			invocation.SetProceedDelegate(() => InvokeReleasePipeline(nextIndex, invocation));
			releaseExtensions[extensionIndex].Intercept(invocation);
		}
コード例 #2
0
ファイル: ExtendedHandler.cs プロジェクト: dohansen/Windsor
		public override bool Release(Burden burden)
		{
			if (releaseExtensions == null)
			{
				return base.Release(burden);
			}

			var invocation = new ReleaseInvocation(burden);
			InvokeReleasePipeline(0, invocation);
			return invocation.ReturnValue;
		}
コード例 #3
0
		public override bool Release(object instance)
		{
			if (releaseExtensions == null)
			{
				return base.Release(instance);
			}

			var invocation = new ReleaseInvocation(instance);
			InvokeReleasePipeline(0, invocation);
			return invocation.ReturnValue;
		}
コード例 #4
0
        private void InvokeReleasePipeline(int extensionIndex, ReleaseInvocation invocation)
        {
            if (extensionIndex >= releaseExtensions.Length)
            {
                invocation.ReturnValue = base.Release(invocation.Burden);
                return;
            }
            var nextIndex = extensionIndex + 1;

            invocation.SetProceedDelegate(() => InvokeReleasePipeline(nextIndex, invocation));
            releaseExtensions[extensionIndex].Intercept(invocation);
        }
コード例 #5
0
        public override bool Release(Burden burden)
        {
            if (releaseExtensions == null)
            {
                return(base.Release(burden));
            }

            var invocation = new ReleaseInvocation(burden);

            InvokeReleasePipeline(0, invocation);
            return(invocation.ReturnValue);
        }
コード例 #6
0
		public void Intercept(ReleaseInvocation invocation)
		{
			if (releasingHandlers != null)
			{
				IList<ComponentReleasingDelegate> releasers;

				lock (releasingHandlers)
				{
					if (releasingHandlers.TryGetValue(invocation.Instance, out releasers))
					{
						releasingHandlers.Remove(invocation.Instance);
					}
				}

				if (releasers != null)
				{
					foreach (var releaser in releasers)
					{
						releaser(kernel);
					}
				}
			}
			invocation.Proceed();
		}