string GetSubKey <T>(Expression <Func <T, bool> > where) where T : IMQEvent { var type = typeof(T); var props = TypeEventBusMetas.GetProperties(type); if (props == null || props.Count == 0) { return(string.Empty); } var body = where.Body as BinaryExpression; var dic = new Dictionary <string, string>(); GetMembers(body, dic); var sb = new StringBuilder(); props.ForEach(e => { if (dic.ContainsKey(e.Name)) { sb.Append(dic[e.Name]); sb.Append('.'); } else { sb.Append("*."); } }); return(sb.ToString()); }
string GetPubKey <T>(T @event) where T : IMQEvent { var type = @event.GetType(); var props = TypeEventBusMetas.GetProperties(type); if (props == null || props.Count == 0) { return(string.Empty); } var sb = new StringBuilder(); foreach (var p in props) { var value = p.Property.Invoke(@event); if (value.GetType().IsValueType) { value = ((int)value).ToString(); } sb.Append(value.ToString()); sb.Append('.'); } var key = sb.ToString(); return(key); }
string GetSubKey <T>() where T : IMQEvent { var type = typeof(T); var props = TypeEventBusMetas.GetProperties(type); if (props == null || props.Count == 0) { return(string.Empty); } return("#."); }