public static void SetPropertyValue(T entity, string propName, object value) { PropertyInfo propInfo = entityType.GetProperty(propName); MethodInfo method = propInfo.GetGetMethod(); Type returnType = method.ReturnType; value = TypeConvert.ChangeType(value, returnType); PropertyHelper.SetPropertyValue(entity, propName, value); }
public static T ChangeType <T>(object value) { return((T)TypeConvert.ChangeType(value, typeof(T))); }