コード例 #1
0
		public void Intercept(ResolveInvocation invocation)
		{
			using (new CustomLifestyle_InstanceScope())
			{
				invocation.Proceed();
			}
		}
コード例 #2
0
        public void Intercept(ResolveInvocation invocation)
        {
            Releasing releasing = null;

            if (resolvers.Count > 0)
            {
                foreach (var resolver in resolvers)
                {
                    var releaser = resolver(kernel, invocation.Context);
                    if (releaser != null)
                    {
                        if (releasing == null)
                        {
                            releasing = new Releasing(resolvers.Count, kernel);
                            invocation.RequireDecommission();
                        }
                        releasing.Add(releaser);
                    }
                }
            }

            invocation.Proceed();

            if (releasing == null)
            {
                return;
            }
            var burden = invocation.Burden;

            if (burden == null)
            {
                return;
            }
            burden.Releasing += releasing.Invoked;
        }
コード例 #3
0
ファイル: Scope.cs プロジェクト: n2cms/Castle.Windsor
		public void Intercept(ResolveInvocation invocation)
		{
			using (new InstanceScope())
			{
				invocation.Proceed();
			}
		}
コード例 #4
0
		public void Intercept(ResolveInvocation invocation)
		{
			Releasing releasing = null;
			if (resolvers.Count > 0)
			{
				foreach (var resolver in resolvers)
				{
					var releaser = resolver(kernel, invocation.Context);
					if (releaser != null)
					{
						if (releasing == null)
						{
							releasing = new Releasing(resolvers.Count, kernel);
							invocation.RequireDecommission();
						}
						releasing.Add(releaser);
					}
				}
			}

			invocation.Proceed();

			if (releasing == null)
			{
				return;
			}
			var burden = invocation.Burden;
			if (burden == null)
			{
				return;
			}
			burden.Releasing += releasing.Invoked;
		}
コード例 #5
0
ファイル: ExtendedHandler.cs プロジェクト: dohansen/Windsor
		protected override object Resolve(CreationContext context, bool instanceRequired)
		{
			if (resolveExtensions == null)
			{
				return base.Resolve(context, instanceRequired);
			}
			var invocation = new ResolveInvocation(context, instanceRequired);
			InvokeResolvePipeline(0, invocation);
			return invocation.ResolvedInstance;
		}
コード例 #6
0
        protected override object Resolve(CreationContext context, bool instanceRequired)
        {
            if (resolveExtensions == null)
            {
                return(base.Resolve(context, instanceRequired));
            }
            var invocation = new ResolveInvocation(context, instanceRequired);

            InvokeResolvePipeline(0, invocation);
            return(invocation.ResolvedInstance);
        }
コード例 #7
0
        private void InvokeResolvePipeline(int extensionIndex, ResolveInvocation invocation)
        {
            if (extensionIndex >= resolveExtensions.Length)
            {
                Burden burden;
                invocation.ResolvedInstance = ResolveCore(invocation.Context,
                                                          invocation.DecommissionRequired,
                                                          invocation.InstanceRequired,
                                                          out burden);
                invocation.Burden = burden;
                return;
            }
            var nextIndex = extensionIndex + 1;

            invocation.SetProceedDelegate(() => InvokeResolvePipeline(nextIndex, invocation));
            resolveExtensions[extensionIndex].Intercept(invocation);
        }
コード例 #8
0
		public void Intercept(ResolveInvocation invocation)
		{
			List<ComponentReleasingDelegate> releasers = null;
			if (resolvingHandler != null)
			{
				foreach (ComponentResolvingDelegate resolver in resolvingHandler.GetInvocationList())
				{
					var releaser = resolver(kernel, invocation.Context);
					if (releaser != null)
					{
						if (releasers == null)
						{
							releasers = new List<ComponentReleasingDelegate>();
							invocation.RequireDecommission();
						}
						releasers.Add(releaser);
					}
				}
			}

			invocation.Proceed();

			if (releasers == null)
			{
				return;
			}

			lock (resolvingHandler)
			{
				if (releasingHandlers == null)
				{
					releasingHandlers = new Dictionary<object, IList<ComponentReleasingDelegate>>();
				}

				if (releasingHandlers.ContainsKey(invocation.ReturnValue) == false)
				{
					releasingHandlers.Add(invocation.ReturnValue, releasers);
				}
			}
		}
コード例 #9
0
ファイル: ExtendedHandler.cs プロジェクト: dohansen/Windsor
		private void InvokeResolvePipeline(int extensionIndex, ResolveInvocation invocation)
		{
			if (extensionIndex >= resolveExtensions.Length)
			{
				Burden burden;
				invocation.ResolvedInstance = ResolveCore(invocation.Context,
				                                          invocation.DecommissionRequired,
				                                          invocation.InstanceRequired,
				                                          out burden);
				invocation.Burden = burden;
				return;
			}
			var nextIndex = extensionIndex + 1;
			invocation.SetProceedDelegate(() => InvokeResolvePipeline(nextIndex, invocation));
			resolveExtensions[extensionIndex].Intercept(invocation);
		}