public static void SetPropertyValue(this object entity, string propertyName, object value) { PropertyInfo property = PropertyFactory.GetPropertyInfo(entity.GetType(), propertyName); if (property != null) { property.SetValue(entity, value.ConvertTo(property.PropertyType), null); } }
public static object GetPropertyValue(this object entity, string propertyName) { PropertyInfo property = PropertyFactory.GetPropertyInfo(entity.GetType(), propertyName); if (property != null) { return(property.GetValue(entity, null)); } return(null); }