本文整理汇总了C#中IEventHandler.GetInnerEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IEventHandler.GetInnerEventHandler方法的具体用法?C# IEventHandler.GetInnerEventHandler怎么用?C# IEventHandler.GetInnerEventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEventHandler
的用法示例。
在下文中一共展示了IEventHandler.GetInnerEventHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DispatchEventToEventHandler
private void DispatchEventToEventHandler(IEventHandler eventHandler, IEvent evnt, int retriedCount, int maxRetryCount)
{
try
{
var eventHandlerTypeName = eventHandler.GetInnerEventHandler().GetType().FullName;
if (!_eventHandleInfoStore.IsEventHandleInfoExist(evnt.Id, eventHandlerTypeName))
{
eventHandler.Handle(evnt);
_eventHandleInfoStore.AddEventHandleInfo(evnt.Id, eventHandlerTypeName);
}
}
catch (Exception ex)
{
LogError(eventHandler, evnt, ex, retriedCount + 1);
if (retriedCount < maxRetryCount)
{
DispatchEventToEventHandler(eventHandler, evnt, retriedCount + 1, maxRetryCount);
}
}
}
示例2: LogError
private void LogError(IEventHandler eventHandler, IEvent evnt, Exception exception, int handleCount)
{
var eventHandlerType = eventHandler.GetInnerEventHandler().GetType();
_logger.Error(
string.Format(
"Exception raised when {0} handling {1}, handled count:{2}.",
eventHandlerType.Name,
evnt.GetType().Name,
handleCount),
exception);
}
示例3: DispatchEventToHandler
private bool DispatchEventToHandler(IDomainEvent evnt, IEventHandler handler)
{
try
{
var eventHandlerTypeCode = _eventHandlerTypeCodeProvider.GetTypeCode(handler.GetInnerEventHandler().GetType());
if (_eventHandleInfoCache.IsEventHandleInfoExist(evnt.Id, eventHandlerTypeCode)) return true;
if (_eventHandleInfoStore.IsEventHandleInfoExist(evnt.Id, eventHandlerTypeCode)) return true;
handler.Handle(evnt);
_eventHandleInfoStore.AddEventHandleInfo(evnt.Id, eventHandlerTypeCode);
_eventHandleInfoCache.AddEventHandleInfo(evnt.Id, eventHandlerTypeCode);
return true;
}
catch (Exception ex)
{
_logger.Error(string.Format("Exception raised when [{0}] handling [{1}].", handler.GetInnerEventHandler().GetType().Name, evnt.GetType().Name), ex);
return false;
}
}