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


C# IEvent.GetType方法代码示例

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


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

示例1: Flow

        public void Flow(IEvent @event)
        {
            var eventsToFlow = new List<IEvent>();
            foreach (var pipelet in pipelets)
            {
                log.DebugFormat("Flowing {0} to {1}", @event.GetType(), pipelet.GetType());
                var resultingEvents = pipelet.Flow(@event);

                if (resultingEvents.Any(e => e.GetType() != typeof (NoopEvent)))
                {
                    log.InfoFormat("Adding {0} events to the pipeline for later flowing, after flowing {1} to {2}",
                                   resultingEvents.Count(),
                                   @event.GetType(),
                                   pipelet.GetType());

                    eventsToFlow.AddRange(resultingEvents);
                }
            }

            log.DebugFormat("Flowing resulting events to the pipeline. There are {0} events to reflow",
                            eventsToFlow.Count);
            foreach (var eventToFlow in eventsToFlow)
            {
                Flow(eventToFlow);
            }
        }
开发者ID:ReggieSA,项目名称:Puppy.Monitoring,代码行数:26,代码来源:CompleteAndReflowPipeline.cs

示例2: Flow

        public IEnumerable<IEvent> Flow(IEvent @event)
        {
            log.InfoFormat("Received {0}", @event.GetType());
            log.DebugFormat("Flowing {0} to decision maker {1} to move the event forward", @event.GetType(),
                            decisionMaker.GetType());

            return decisionMaker.MakeDecision(@event);
        }
开发者ID:rivethead,项目名称:Puppy.Monitoring,代码行数:8,代码来源:SplitterPipelet.cs

示例3: Envelope

        public Envelope(IEvent message)
        {
            this.Headers = message.Headers;
            this.Body = message.Serialize();
            this.EventType = message.GetType().FullName;

            if (string.IsNullOrEmpty(this.Topic)) { this.Topic = message.GetType().FullName; }
        }
开发者ID:Berico-Technologies,项目名称:Event-Bus,代码行数:8,代码来源:Envelope.cs

示例4: Flow

        public IEnumerable<IEvent> Flow(IEvent @event)
        {
            log.InfoFormat("Received {0} in pipelet {1}", @event.GetType(), this.GetType());

            if (!WantsEvent(@event))
            {
                log.InfoFormat("Ignoring event {0} because filter is not satisfied", @event.GetType());

                return ListOfEvents.EmptyList();
            }

            return Accept(@event);
        }
开发者ID:rivethead,项目名称:Puppy.Monitoring,代码行数:13,代码来源:BasePipelet.cs

示例5: Equals

 public bool Equals(IEvent toCompare)
 {
     if (toCompare.GetType().Equals(typeof(Unused)))
         return true;
     else
         return false;
 }
开发者ID:jeremyklamer,项目名称:EventSourcingConflictResolution,代码行数:7,代码来源:Unused.cs

示例6: OnEvent

 private void OnEvent(IEvent @event, bool isNew)
 {
     string eventName = "On" + @event.GetType().Name.Replace("Event", "");
     MethodInfo method = GetType().GetMethod(eventName);
     method.Invoke(this, new object[] { @event });
     if (isNew)_uncommitedEvents.Add(@event);
 }
开发者ID:brandongrossutti,项目名称:EventStore,代码行数:7,代码来源:AggregateRoot.cs

示例7: ApplyChange

        /// <summary>
        /// Apply the event
        /// </summary>
        /// <param name="event"></param>
        /// <param name="isNew"></param>
        public void ApplyChange(IEvent @event, bool isNew = true)
        {
            var targetType = GetType();
            var methodsToMatch = targetType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            var expectedName = string.Format("On{0}", @event.GetType().Name);

            foreach (var method in methodsToMatch) {

                if (string.Compare(method.Name, expectedName, StringComparison.OrdinalIgnoreCase) != 0)
                    continue;

                var parameters = method.GetParameters();

                if (parameters.Length != 1 || !typeof(IEvent).IsAssignableFrom(parameters[0].ParameterType))
                    continue;

                method.Invoke(this, new[] { @event });

                if (isNew)
                    _changes.Add(@event);

                return;
            }

            throw new Exception(string.Format("Could not find a method named {0} on type {1}", expectedName, GetType().Name));
        }
开发者ID:reiroldan,项目名称:dotnetkb,代码行数:31,代码来源:AggregateRoot.cs

示例8: Publish

 public void Publish(IEvent @event)
 {
     Console.WriteLine("========================================");
     Console.WriteLine("Publishing event {0}", @event.GetType());
     Console.WriteLine("Event {0}", @event);
     Console.WriteLine("========================================");
 }
开发者ID:rivethead,项目名称:Puppy.Monitoring,代码行数:7,代码来源:ConsolePublisher.cs

示例9: EventHandler

		/*============================================================================*/
		/* Private Functions                                                          */
		/*============================================================================*/

		private void EventHandler(IEvent evt)
		{
			/**
			 * Map(CustomType, typeof(IEvent)). 	Dispatch(new CustomEvent(CustomType)).	Make it inject IEvent
			 * Map(CustomType). 					Dispatch(new Event(CustomType)).		Make it inject IEvent
			 * Map(CustomType). 					Dispatch(new CustomEvent(CustomType)).	Make it inject CustomEvent
			 * 
			 * Map(CustomType).typeof(CustomType)	Dispatch(new Event(CustomType)).		Make it not execute
			 */

			Type evtType = evt.GetType ();
			Type payloadEvtType = null;
			if (evtType == _eventClass || (_eventClass == null))
			{
				payloadEvtType = (evtType == typeof(Event)) ? typeof(IEvent) : evtType;
			}
			else if (_eventClass == typeof(IEvent))
			{
				payloadEvtType = _eventClass;
				payloadEvtType = typeof (IEvent);
			}
			else
				return;

			_executor.ExecuteCommands(_mappings.GetList(), new CommandPayload (new List<object>{ evt }, new List<Type>{ payloadEvtType }));
		}
开发者ID:mikecann,项目名称:robotlegs-sharp-framework,代码行数:30,代码来源:EventCommandTrigger.cs

示例10: RebuildPipeline

        protected IEnumerable<IPipelet> RebuildPipeline(IEvent @event)
        {
            log.InfoFormat("Rebuilding pipeline for event {0}", @event.GetType());

            var rebuildPipeline = pipelets.Where(p => p.WantsEvent(@event)).ToList();
            return rebuildPipeline;
        }
开发者ID:rivethead,项目名称:Puppy.Monitoring.Core,代码行数:7,代码来源:BasePipeline.cs

示例11: Send

        public void Send(IEvent @event)
        {
            var eventType = @event.GetType();
            var eventTypes = new List<Type>{ eventType };

            var baseEventType = eventType.BaseType;

            while (baseEventType != null && typeof(IEvent).IsAssignableFrom(baseEventType))
            {
                eventTypes.Add(baseEventType);
                baseEventType = baseEventType.BaseType;
            }

            foreach (var @interface in eventType.GetInterfaces())
            {
                if (typeof(IEvent).IsAssignableFrom(@interface))
                {
                    eventTypes.Add(@interface);
                }
            }

            foreach (var type in eventTypes)
            {
                var handlers = FindDirectHandlers(type);
                InvokeHandlers(@event, handlers);
            }
        }
开发者ID:mouhong,项目名称:Taro,代码行数:27,代码来源:InProcessEventTransport.cs

示例12: SatisfiedBy

        public bool SatisfiedBy(IEvent @event)
        {
            if (@event.GetType() != typeof (NumberOfEventsEvent))
                return false;

            return (@event as NumberOfEventsEvent).Number >= greaterThan && successor.SatisfiedBy(@event);
        }
开发者ID:ReggieSA,项目名称:Puppy.Monitoring,代码行数:7,代码来源:NumberOfEventsGreaterThanSpecification.cs

示例13: EventDescriptor

 public EventDescriptor(IEvent eventData, EventHeader header)
     : this()
 {
     var type = eventData.GetType();
     var name = String.Format("{0},{1}", type.FullName, type.Assembly.GetName().Name);
     EventData = new EventData(name, eventData);
     Header = header;
 }
开发者ID:brucewu16899,项目名称:lacjam,代码行数:8,代码来源:EventDescriptor.cs

示例14: PublishEvent

        public static int Instance { get; private set; } // TODO: Re-evaluate need for static instance counter - it was added for testing IoC only

        public void PublishEvent( IEvent evnt )
        {
            List<IEventListener> listeners;
            if ( Listeners.TryGetValue( evnt.GetType(), out listeners ) )
            {
                listeners.ForEach( a => a.HandleEvent( evnt ) );
            }
        }
开发者ID:cmgator,项目名称:Symbiote,代码行数:10,代码来源:EventListenerManager.cs

示例15: Accept

        protected override IEnumerable<IEvent> Accept(IEvent @event)
        {
            log.DebugFormat("Publishing {0} to {1} publiser", @event.GetType(), publisher.GetType());

            publisher.Publish(@event);

            return ListOfEvents.EmptyList();
        }
开发者ID:rivethead,项目名称:Puppy.Monitoring.Core,代码行数:8,代码来源:PublishingPipelet.cs


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