当前位置: 首页>>代码示例>>C#>>正文


C# CreationContext.GetContextualProperty方法代码示例

本文整理汇总了C#中Castle.MicroKernel.Context.CreationContext.GetContextualProperty方法的典型用法代码示例。如果您正苦于以下问题:C# CreationContext.GetContextualProperty方法的具体用法?C# CreationContext.GetContextualProperty怎么用?C# CreationContext.GetContextualProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Castle.MicroKernel.Context.CreationContext的用法示例。


在下文中一共展示了CreationContext.GetContextualProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Resolve

		public override object Resolve(CreationContext context, Burden burden, IReleasePolicy releasePolicy)
		{
			if (cachedBurden != null)
			{
				return cachedBurden.Instance;
			}
			var instanceFromContext = context.GetContextualProperty(ComponentActivator);
			if (instanceFromContext != null)
			{
				//we've been called recursively, by some dependency from base.Resolve call
				return instanceFromContext;
			}
			object instance;
			lock (ComponentActivator)
			{
				if (cachedBurden != null)
				{
					return cachedBurden.Instance;
				}
				instance = base.CreateInstance(context, burden);
				cachedBurden = burden;
			}
			Track(burden, releasePolicy);
			return instance;
		}
开发者ID:firegrass,项目名称:Castle.Windsor,代码行数:25,代码来源:SingletonLifestyleManager.cs

示例2: Resolve

		public override object Resolve(CreationContext context, IReleasePolicy releasePolicy)
		{
			// 1. read from cache
			if (cachedBurden != null)
			{
				return cachedBurden.Instance;
			}
			var instanceFromContext = context.GetContextualProperty(ComponentActivator);
			if (instanceFromContext != null)
			{
				//we've been called recursively, by some dependency from base.Resolve call
				return instanceFromContext;
			}

			var initializing = false;
			try
			{
				initializing = init.ExecuteThreadSafeOnce();
				if (cachedBurden != null)
				{
					return cachedBurden.Instance;
				}
				var burden = CreateInstance(context, true);
				cachedBurden = burden;
				Track(burden, releasePolicy);
				return burden.Instance;
			}
			finally
			{
				if (initializing)
				{
					init.EndThreadSafeOnceSection();
				}
			}
		}
开发者ID:hjlfmy,项目名称:Castle.Windsor-READONLY,代码行数:35,代码来源:SingletonLifestyleManager.cs

示例3: Resolve

		public override object Resolve(CreationContext context)
		{
			if (instance == null)
			{
				var instanceFromContext = context.GetContextualProperty(ComponentActivator);
				if (instanceFromContext != null)
				{
					//we've been called recursively, by some dependency from base.Resolve call
					return instanceFromContext;
				}
				lock (ComponentActivator)
				{
					if (instance == null)
					{
						instance = base.Resolve(context);
					}
				}
			}

			return instance;
		}
开发者ID:gschuager,项目名称:Castle.Windsor,代码行数:21,代码来源:SingletonLifestyleManager.cs

示例4: Resolve

		public override object Resolve(CreationContext context, IReleasePolicy releasePolicy)
		{
			// 1. read from cache
			if (cachedBurden != null)
			{
				return cachedBurden.Instance;
			}
			var instanceFromContext = context.GetContextualProperty(ComponentActivator);
			if (instanceFromContext != null)
			{
				//we've been called recursively, by some dependency from base.Resolve call
				return instanceFromContext;
			}

			lock (ComponentActivator)
			{
				if (cachedBurden != null)
				{
					return cachedBurden.Instance;
				}
				return GetNewInstance(context, releasePolicy);
			}
		}
开发者ID:corruptmem,项目名称:Castle.Windsor,代码行数:23,代码来源:SingletonLifestyleManager.cs

示例5: GetContextInstance

		public object GetContextInstance(CreationContext context)
		{
			return context.GetContextualProperty(ComponentActivator);
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:4,代码来源:SingletonLifestyleManager.cs


注:本文中的Castle.MicroKernel.Context.CreationContext.GetContextualProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。