private List <Type> GetFullTypes(IEnumerable <object> messages) { var types = new List <Type>(); foreach (var m in messages) { var s = m.GetType(); if (types.Contains(s)) { continue; } types.Add(s); foreach (var t in s.GetInterfaces()) { if (messageMapper.IsMessageType(t)) { if (!types.Contains(t)) { types.Add(t); } } } var baseType = s.BaseType; while (baseType != null && baseType != typeof(object)) { if (messageMapper.IsMessageType(baseType)) { if (!types.Contains(baseType)) { types.Add(baseType); } } baseType = baseType.BaseType; } } return(types); }
private List <string> GetBaseTypes(object[] messages) { var result = new List <string>(); foreach (var m in messages) { Type t = mapper.GetMappedTypeFor(m.GetType()); Type baseType = t.BaseType; while (baseType != typeof(object) && baseType != null) { if (mapper.IsMessageType(baseType)) { if (!result.Contains(baseType.FullName)) { result.Add(baseType.FullName); } } baseType = baseType.BaseType; } foreach (Type i in t.GetInterfaces()) { if (i != typeof(IMessage) && mapper.IsMessageType(baseType)) { if (!result.Contains(i.FullName)) { result.Add(i.FullName); } } } } return(result); }