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


C# IHandler类代码示例

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


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

示例1: 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

示例2: Kernel_ComponentRegistered

 private void Kernel_ComponentRegistered(string key, IHandler handler)
 {
     if (ShouldIntercept(handler.ComponentModel.Implementation))
     {
         handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(AuditingInterceptor)));
     }
 }
开发者ID:dazyzsy,项目名称:ZBP,代码行数:7,代码来源:AuditingInterceptorRegistrar.cs

示例3: HelpMenuHandler

        public HelpMenuHandler(IHandler returnTo, string buttonName, GameHandler game = null)
        {
            background = Main.content.Load<Texture2D>((string)Main.Config[buttonName]["background"]);

            returnButton = new MoveButton(returnTo, (JObject)Main.Config[buttonName], true);
            this.game = game;
        }
开发者ID:FeldrinH,项目名称:ProjectBueno,代码行数:7,代码来源:HelpMenuHandler.cs

示例4: Inspect

		public void Inspect(IHandler handler, DependencyModel[] missingDependencies, IKernel kernel)
		{
			if (handlersChecked.Add(handler) == false)
			{
				return;
			}
			Debug.Assert(missingDependencies.Length > 0, "missingDependencies.Length > 0");
			var uniqueOverrides = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			message.AppendLine();
			message.AppendFormat("'{0}' is waiting for the following dependencies:", handler.ComponentModel.Name);
			message.AppendLine();
			foreach (var dependency in missingDependencies)
			{
				if (dependency.ReferencedComponentName != null)
				{
					// NOTE: that's a workaround for us having dependency twice potentially, once from configuration and once from actual type scan
					if (uniqueOverrides.Add(dependency.ReferencedComponentName))
					{
						InspectServiceOverrideDependency(dependency, kernel);
					}
				}
				else if (dependency.IsPrimitiveTypeDependency)
				{
					//hardcoding string as it's a most common type that is not value type but you wouldn't want to kave that as a service.
					InspectParameterDependency(dependency);
				}
				else
				{
					InspectServiceDependency(handler, dependency, kernel);
				}
			}
		}
开发者ID:RookieX,项目名称:Windsor,代码行数:32,代码来源:DependencyInspector.cs

示例5: SetUp

 public void SetUp()
 {
     _successor = MockRepository.GenerateStub<IHandler>();
     _handler = new OptionsHandler(_successor);
     _endpointDetails = MockRepository.GenerateStub<IEndpointDetails>();
     _credentials = MockRepository.GenerateStub<ICredentials>();
 }
开发者ID:bnathyuw,项目名称:nonae,代码行数:7,代码来源:OptionsHandlerTests.cs

示例6: AddResponsiblity

		public void AddResponsiblity(object instance, IHandler handler)
		{
			if (instance == null) throw new ArgumentNullException("instance");
			if (handler == null) throw new ArgumentNullException("handler");
			
			references.Add(new DecomissioningResponsibilityReference(instance, handler));
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:7,代码来源:DecomissioningResponsibility.cs

示例7: AddAssemblyLevelAttributes

 private void AddAssemblyLevelAttributes(List<Attribute> attributes, IHandler handler)
 {
     attributes.AddRange(
         (Attribute[])
         handler.ComponentModel.Implementation.Assembly.GetCustomAttributes(typeof(ExceptionHandlerAttribute),
                                                                            false));
 }
开发者ID:jmptrader,项目名称:WebFrameworkMVC,代码行数:7,代码来源:ExceptionHandlerFacility.cs

示例8: ComponentRegistered

        void ComponentRegistered(string key, IHandler handler)
        {
            if (!(handler.ComponentModel.Implementation.IsPublic || handler.ComponentModel.Implementation.IsNestedPublic))
                return;

            var matchedAspects = new List<IAspectSelector>();
            foreach (var aspect in aspectSelectors)
            {
                if (aspect.Enabled &&
                    aspect.IsMatch(handler.ComponentModel.Service))
                {
                    if (matchedAspects.Count == 0)
                        handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(AspectInterceptor)));
                    matchedAspects.Add(aspect);

                    logger.DebugFormat("Adding aspect {0} to service {1}", aspect, handler.ComponentModel.Service);
                }
            }
            // tell the component what aspects are matched.
            // give it only the matching aspects so it doesn't need to re-run IsMatch
            if (matchedAspects.Count > 0)
            {
                if (!handler.ComponentModel.ExtendedProperties.Contains(AspectInterceptor.AspectSelectorsExtendedPropertyName))
                {
                    handler.ComponentModel.ExtendedProperties.Add(
                        AspectInterceptor.AspectSelectorsExtendedPropertyName, matchedAspects);
                }
            }
        }
开发者ID:tpeplow,项目名称:CastleAOP,代码行数:29,代码来源:AspectFacility.cs

示例9: WorkerEngine

     public WorkerEngine(ISerializer serializer, IHandler handler, string loadbalancerAddress)
     {
         m_serializer = serializer;
         m_loadbalancerAddress = loadbalancerAddress;
         m_handler = handler;
         m_nextMessageId = 0;
 }
开发者ID:somdoron,项目名称:NetMQ.High,代码行数:7,代码来源:WorkerEngine.cs

示例10: EndPoint

 public EndPoint(string method, string pattern, IHandler handler)
 {
     this.method = method;
     this.pattern = pattern;
     this.regex = this.ToRegex(pattern);
     this.Handler = handler;
 }
开发者ID:shaunstanislaus,项目名称:winappdriver,代码行数:7,代码来源:EndPoint.cs

示例11: TextureBrush

		TextureBrush (IHandler handler, Image image, float opacity)
		{
			this.handler = handler;
			this.ControlObject = handler.Create (image, opacity);
			this.Image = image;
			this.opacity = opacity;
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:7,代码来源:TextureBrush.cs

示例12: KernelOnComponentRegistered

 private static void KernelOnComponentRegistered(string key, IHandler handler)
 {
     if (UnitOfWorkHelper.IsConventionalUowClass(handler.ComponentModel.Implementation))
     {
         handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
     }
 } 
开发者ID:rickxie,项目名称:MiniAbp,代码行数:7,代码来源:UnitOfWorkRegistrar.cs

示例13: Register

        public virtual void Register(String key, IHandler handler)
        {
            Type service = handler.Service;

            try
            {
                locker.AcquireWriterLock(Timeout.Infinite);
                if (key2Handler.Contains(key))
                {
                    throw new ComponentRegistrationException(
                        String.Format("There is a component already registered for the given key {0}", key));
                }

                if (!service2Handler.Contains(service))
                {
                    this[service] = handler;
                }

                this[key] = handler;
            }
            finally
            {
                locker.ReleaseLock();
            }
        }
开发者ID:ralescano,项目名称:castle,代码行数:25,代码来源:DefaultNamingSubSystem.cs

示例14: ELM327ListenerEventArgs

 /// <summary>
 /// Creates a new ELM327ListenerEventArgs object.
 /// </summary>
 /// <param name="handler">The handler that generated this event.</param>
 /// <param name="processedResponse">Processed form of the received response.</param>
 /// <param name="isBadResponse">Indicates if any errors were detected in the response.</param>
 /// <param name="responseErrors">Description of any errors detected in the response.</param>
 public ELM327ListenerEventArgs(IHandler handler, object processedResponse, bool isBadResponse, string responseErrors)
 {
     _handler = handler;
     _processedResponse = processedResponse;
     _isBadResponse = isBadResponse;
     _responseErrors = responseErrors;
 }
开发者ID:miaozhendaoren,项目名称:obd-express,代码行数:14,代码来源:ELM327ListenerEventArgs.cs

示例15: 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


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