1234567891011121314151617181920212223242526272829303132333435 |
- using EventBus;
- namespace ActiveMQCommunication
- {
- static class PropertiesConverter
- {
- public static Dictionary<string,string> PropertiesToDic(this Properties properties)
- {
- if (properties == null || properties.Count ==0) return null;
- Dictionary<string, string> dic = new Dictionary<string, string>();
- foreach (var item in properties.Names)
- {
- dic[item] = properties[item];
- }
- return dic;
- }
- public static string PropertiesToselector(this Properties properties)
- {
- if (properties == null || properties.Count == 0) return string.Empty;
- string s = "";
- foreach(var val in properties.Names)
- {
- if(string.IsNullOrEmpty(s))
- {
- s = $"{val} = {properties[val]}";
- }
- else
- {
- s += $"and {val} = {properties[val]}";
- }
- }
- return s;
- }
- }
- }
|