本文整理汇总了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());
}
示例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();
}
示例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"));
}
示例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);
}
示例5: Bind
public IHandler Bind(IHandler[] handlers)
{
return handlers.First();
}
示例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)));
}
示例7: SelectHandler
public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
{
return handlers.First(x => x.ComponentModel.Implementation == typeof(CachedClientRepository));
}