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


C# IHandler.Where方法代码示例

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


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

示例1: SelectHandlers

			public IHandler[] SelectHandlers(Type service, IHandler[] handlers)
			{
				return handlers
					.Where(h => h.ComponentModel.Implementation != typeof(Task4))
					.OrderBy(h => h.ComponentModel.Implementation.Name)
					.ToArray();
			}
开发者ID:pil0t,项目名称:Castle.Windsor,代码行数:7,代码来源:HandlerFilterTestCase.cs

示例2: SelectHandler

 public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
 {
     var id = string.Format("{0}:{1}", service.Name, GetHostname());
     var selectedHandler = handlers.Where(h => h.ComponentModel.Name == id).FirstOrDefault() ??
                           GetDefaultHandler(service, handlers);
     return selectedHandler;
 }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:7,代码来源:UrlBasedComponentSelector.cs

示例3: SelectHandler

        public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
        {
            if (handlers.Length == 0)
                return null;

            var featureSwitcherHandlers = handlers
                .Where(handler => handler.ComponentModel.ExtendedProperties.Contains(ExtendedPropertyName))
                .Select(handler => new
                {
                    Handler = handler,
                    Metadata = handler.ComponentModel.ExtendedProperties[ExtendedPropertyName] as RegistrationMetadata
                })
                .ToArray();
                
            if (featureSwitcherHandlers.Length == 0)
                return null;

            if (featureSwitcherHandlers.Length != 2)
                throw new ComponentRegistrationException("Incorrect feature switch configuration");

            var feature = featureSwitcherHandlers[0].Metadata.Feature;

            return feature.Is().Enabled 
                ? featureSwitcherHandlers.FirstOrDefault(handler => handler.Metadata.Enabled)?.Handler 
                : featureSwitcherHandlers.FirstOrDefault(handler => !handler.Metadata.Enabled)?.Handler;
        }
开发者ID:queueit,项目名称:FeatureSwitcher.Windsor,代码行数:26,代码来源:FeatureSwitcherHandler.cs

示例4: SelectHandler

        public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
        {
            var handlersForService = handlers.Where(h => h.ComponentModel.Name == key || h.ComponentModel.Services.Any(t => t == typeof(ISessionFactory))).ToArray();

            if (handlersForService.Count() > 1)
            {
                // HACK: The default handler should result in one service, but seems not to be the case. Return the last one of the default ones.
                var defaultHandler =
                    handlersForService.LastOrDefault(
                        h => h.ComponentModel.ExtendedProperties.Contains(Constants.DefaultComponentForServiceFilter));
                return defaultHandler ?? handlersForService.FirstOrDefault();
            }
            return handlersForService.FirstOrDefault();
        }
开发者ID:martijnboland,项目名称:cuyahoga-1,代码行数:14,代码来源:SessionFactoryHelper.cs

示例5: SelectHandler

        public IHandler SelectHandler(string key, Type service, IHandler[] handlers)
        {
            try
            {
                var context = _context.Invoke();

                if (context == null) return null;

                var httpCookie = context.Request.Cookies[_testname];

                if (httpCookie == null) return null;

                return handlers.Where(x => x.ComponentModel.Name.Contains(httpCookie.Value)).FirstOrDefault();

            }catch(HttpException)
            {
                return null;
            }
        }
开发者ID:darkin100,项目名称:ReallySimpleABTesting,代码行数:19,代码来源:AdvertHandlerSelector.cs

示例6: SelectHandlers

			public IHandler[] SelectHandlers(Type service, IHandler[] handlers)
			{
				handlersAsked = handlers;
				return handlers.Where(filter).ToArray();
			}
开发者ID:dohansen,项目名称:Windsor,代码行数:5,代码来源:HandlerFilterTestCase.cs


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