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


C# IHandler.First方法代码示例

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


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

示例1: SelectHandler

        public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
        {
            var module = service.GetAppModule();

            if (configuration.IsActive(module))
                return handlers.First(x => x.ComponentModel.Implementation.IsNotNullImplementation());

            return handlers.First(x => x.ComponentModel.Implementation.IsNullImplementation());
        }
开发者ID:jmhdez,项目名称:IHandlerSelector-Sample,代码行数:9,代码来源:ModulesHandlerSelector.cs

示例2: GetMismatchMessage

		private string GetMismatchMessage(IHandler[] handlers)
		{
			var message = new StringBuilder();
			Debug.Assert(handlers.Length > 1, "handlers.Length > 1");
			var root = handlers.First();
			var last = handlers.Last();
			message.AppendFormat("Component '{0}' with lifestyle {1} ", GetNameDescription(root.ComponentModel), root.ComponentModel.GetLifestyleDescription());
			message.AppendFormat("depends on '{0}' with lifestyle {1}", GetNameDescription(last.ComponentModel), last.ComponentModel.GetLifestyleDescription());

			for (var i = 1; i < handlers.Length - 1; i++)
			{
				var via = handlers[i];
				message.AppendLine();
				message.AppendFormat("\tvia '{0}' with lifestyle {1}", GetNameDescription(via.ComponentModel), via.ComponentModel.GetLifestyleDescription());
			}

			message.AppendLine();
			message.AppendFormat(
				"This kind of dependency is usually not desired and may lead to various kinds of bugs.");
			return message.ToString();
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:21,代码来源:PotentialLifestyleMismatches.cs

示例3: SelectHandler

 public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
 {
     return HttpContext.Current == null
         ? handlers.First(a => a.ComponentModel.Name.Equals("ThreadSessionContainer"))
         : handlers.First(a => a.ComponentModel.Name.Equals("HttpSessionContainer"));
 }
开发者ID:kduberstein,项目名称:MvcMusicStore,代码行数:6,代码来源:StorageContainerSelector.cs

示例4: MismatchedComponentView

		private DebuggerViewItem MismatchedComponentView(IHandler[] handlers)
		{
			var item = GetItem(handlers);
			var key = GetKey(handlers.Last());
			var name = GetName(handlers, handlers.First());
			return new DebuggerViewItem(name, key, item);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:7,代码来源:PotentialLifestyleMismatches.cs

示例5: Bind

			public IHandler Bind(IHandler[] handlers)
			{
				return handlers.First();
			}
开发者ID:castleproject,项目名称:Windsor,代码行数:4,代码来源:BoundComponent.cs

示例6: MismatchedComponentView

 private object MismatchedComponentView(IHandler[] handlers)
 {
     return new DebuggerViewItemWithDetails(GetName(handlers, handlers.First()),
                                            GetKey(handlers.Last()),
                                            GetMismatchMessage(handlers),
                                            Array.ConvertAll(handlers, h => ComponentDebuggerView.BuildFor(h)));
 }
开发者ID:a9512648,项目名称:Windsor,代码行数:7,代码来源:PotentialLifestyleMismatches.cs

示例7: SelectHandler

 public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
 {
     return handlers.First(x => x.ComponentModel.Implementation == typeof(CachedClientRepository));
 }
开发者ID:BravoAlpha,项目名称:ALapAroundIoCContainersDemo,代码行数:4,代码来源:DataAccessHandlerSelector.cs


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