public int GetHashCode(Type eventType)
        {
            var eventTypeAttribute = EventTypeAttribute.GetEventTypeFrom(eventType);
            var attribute          = eventType.GetCustomAttribute(typeof(EventTypeAttribute)) as EventTypeAttribute;
            var version            = attribute?.Version ?? -1;

            var hashCode = eventTypeAttribute.GetHashCode() ^ version;

            return(hashCode.GetHashCode());
        }
        public static Type?GetEventType(string name, int version)
        => EventTypes.SingleOrDefault(type =>
        {
            var typeName    = EventTypeAttribute.GetEventTypeFrom(type);
            var typeVersion =
                Attributes.GetCustomAttributeValue <EventTypeAttribute, int>(type, attribute => attribute.Version);

            return(string.Equals(typeName, name, StringComparison.InvariantCultureIgnoreCase) &&
                   version.Equals(typeVersion));
        });
        public bool Equals(Type?event1, Type?event2)
        {
            if (event1 == null && event2 == null)
            {
                return(true);
            }

            if (event1 == null || event2 == null)
            {
                return(false);
            }

            var eventTypeAttribute1 = EventTypeAttribute.GetEventTypeFrom(event1);
            var eventTypeAttribute2 = EventTypeAttribute.GetEventTypeFrom(event1);

            var version1 = Attributes.GetCustomAttributeValue <EventTypeAttribute, int>(event1, attribute => attribute.Version);
            var version2 = Attributes.GetCustomAttributeValue <EventTypeAttribute, int>(event2, attribute => attribute.Version);

            return(eventTypeAttribute1.Equals(eventTypeAttribute2, StringComparison.InvariantCultureIgnoreCase) &&
                   version1.Equals(version2));
        }