Esempio n. 1
0
		public void RegisterCurrent(ContainerContext context)
		{
			lock (contexts)
			{
				var stack = GetContextHistory(Thread.CurrentThread);
				stack.Push(context);
			}
		}
Esempio n. 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 !?");
				}
			}
		}