public static string GetQueueName <TMessage>() where TMessage : new() { var obj = new TMessage(); var imsg = obj as IQueueMessage; if (imsg != null) { return(imsg.QueueName); } else { return(obj.GetType().FullName); } }
public static Boolean RegisterMessageType <TMessage>() where TMessage : INetMessage, new() { var inst = new TMessage(); Type type = inst.GetType(); Int32 hash = GetNetworkCoreHash(type); if (netMessages.ContainsKey(hash)) { Log.Error("Tried to register a message type with a duplicate hash"); return(false); } else { netMessages[hash] = inst; return(true); } }