protected Dictionary <string, object> ToValues() { Dictionary <string, object> values = new Dictionary <string, object>(); Dictionary <string, string> map = GetTableMap(); Type type = GetType(); foreach (string key in map.Keys) { PropertyInfo property = type.GetProperty(key); object value = RestDatabase.ToQueryValue(property.GetValue(this)); if (value != null) { values[map[key]] = value; } } return(values); }
protected virtual List <string> BuildQuery() { List <string> conditions = new List <string>(); Dictionary <string, RestConditionAttribute> map = GetConditionsMap(); Type type = GetType(); foreach (string key in map.Keys) { RestConditionAttribute conditionAttribute = map[key]; PropertyInfo property = type.GetProperty(key); object value = RestDatabase.ToQueryValue(property.GetValue(this)); if (value != null) { string condition = string.Format("{0} {1} {2}", conditionAttribute.Name, conditionAttribute.Operator, value); conditions.Add(condition); } } return(conditions); }