コード例 #1
0
		public void RegisterCurrent(ContainerContext context)
		{
			lock (contexts)
			{
				var stack = getContextHistory(Thread.CurrentThread);
				stack.Push(context);
			}
		}
コード例 #2
0
		public void UnregisterCurrent(ContainerContext context)
		{
			lock (contexts)
			{
				var stack = getContextHistory(Thread.CurrentThread);
				var lastContext = stack.Pop();
				if (lastContext != context)
				{
					throw new InvalidOperationException(
						"Something goes wrong. The current context is not the one initialized at last !?");
				}
			}
		}