public string FindEventTypeCode <TEventDataType>(IClaptrapBox claptrapBox, TEventDataType eventDataType) { var claptrapDesign = _claptrapDesignStore.FindDesign(claptrapBox.Claptrap.State.Identity); var(key, _) = claptrapDesign.EventHandlerDesigns.SingleOrDefault(x => x.Value.EventDataType == typeof(TEventDataType)); return(key); }
public string GetClaptrapTypeCode(IClaptrapBox claptrapBox) { // to find type code from attribute as this method is invoke before claptrap activated. Identity is unable to be used. var claptrapStateAttribute = claptrapBox .GetType() .GetInterfaces() .Select(x => x.GetCustomAttribute <ClaptrapStateAttribute>()) .Single(x => x != null); var typeCode = claptrapStateAttribute.ClaptrapTypeCode; return(typeCode); }
public string GetClaptrapTypeCode(IClaptrapBox claptrapBox) { return(GetClaptrapTypeCode(claptrapBox.GetType())); }