private Dictionary <string, string> Serialize <T>(T item, bool partial = false) { var result = new Dictionary <string, string>(); var properties = partial ? StoreEntityTypesCache.GetTypePartialValueProperties(typeof(T)) : StoreEntityTypesCache.GetTypeProperties(typeof(T)); if (properties != null) { foreach (var pi in properties.Values) { result.Add(pi.Name, GetStringValue((pi.GetValue(item, null) ?? string.Empty)).ToString()); } } return(result); }
private void InternalDeserializeValue <T>(T newitem, KeyValuePair <string, string>[] values, bool partial) { if (values != null) { var properties = partial ? StoreEntityTypesCache.GetTypePartialValueProperties(typeof(T)) : StoreEntityTypesCache.GetTypeProperties(typeof(T)); if (properties != null) { foreach (var kvp in values) { if (!string.IsNullOrEmpty(kvp.Value) && properties.ContainsKey(kvp.Key)) { var pi = properties[kvp.Key]; pi.SetValue(newitem, ConvertTo(pi.PropertyType, kvp.Value), null); } } } } }