public EventEvaluatorListItem(string name, Version minimumVersion, Version maximumVersion, Type viewType, IEventEvaluator evaluator) { Name = name; MinimumVersion = minimumVersion; MaximumVersion = maximumVersion; ViewType = viewType; Evaluator = evaluator; }
private void EvaluateEvent <TView>(IEventEvaluator eventEvaluator, TView view, IEvent @event) where TView : class, IView { var eventDataTypes = eventEvaluator .GetType() .GetInterfaces() .Where(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEventEvaluator <,>) && t.GetGenericArguments()[0] == typeof(TView)) .Select(t => t.GetGenericArguments()[1]).ToArray(); foreach (var eventDataType in eventDataTypes) { var eventData = _eventDataDeserializationService.Deserialize(eventDataType, @event.EventData); ((dynamic)eventEvaluator).Evaluate(view, @event, (dynamic)eventData); } }