public object ToJournal(object evt)
        {
            try
            {
                var aggregateName = evt
                                    .GetType()
                                    .GetCommittedEventAggregateRootName();

                var eventDefinitionService = new EventDefinitionService(null);

                var aggregateEventType = evt
                                         .GetType()
                                         .GetCommittedEventAggregateEventType();

                eventDefinitionService.Load(aggregateEventType);
                var eventDefinition = eventDefinitionService.GetDefinition(aggregateEventType);

                var tags = new HashSet <string> {
                    aggregateName.Value, eventDefinition.Name
                };
                evt.GetType().GetAllCustomAttributes <TagAttribute>().Select(a => a.Name).Foreach(s => tags.Add(s));

                return(new Tagged(evt, tags));
            }
            catch
            {
                return(evt);
            }
        }
예제 #2
0
        public object ToJournal(object evt)
        {
            try
            {
                var aggregateName = evt
                                    .GetType()
                                    .GetCommittedEventAggregateRootName();

                var eventDefinitionService = new EventDefinitionService(null);

                var aggregateEventType = evt
                                         .GetType()
                                         .GetCommittedEventAggregateEventType();

                eventDefinitionService.Load(aggregateEventType);
                var eventDefinition = eventDefinitionService.GetDefinition(aggregateEventType);

                return(new Tagged(evt, new[] { aggregateName.Value, eventDefinition.Name }));
            }
            catch
            {
                return(evt);
            }
        }