itemwill be PropertyInfo. You should use:
object value = item.GetValue(obj, null);
Note that you pretty much ignore the type parameter TEntityat the moment. You can use:
foreach (var property in typeof(TEntity).GetProperties())
So if someone calls
SQLInsert<Customer>(customer)
and the value customeractually refers to a subclass customerwith additional properties, only properties will be used customer.
source
share