tmsmith / Dapper-Extensions

Dapper Extensions is a small library that complements Dapper by adding basic CRUD operations (Get, Insert, Update, Delete) for your POCOs. For more advanced querying scenarios, Dapper Extensions provides a predicate system. The goal of this library is to keep your POCOs pure by not requiring any attributes or base class inheritance.
1.79k stars 586 forks source link

fix DapperExtensions.Get will occur exception when parameter id is no… #321

Open noneiori opened 1 year ago

noneiori commented 1 year ago

…t a KeyValuePair (issue #315)

Hi,

According to get-operation,it will get a sinlge object, but I get a exception because wherePredicate this variable return a empty IPredicate,

foreach (var kvp in ReflectionHelper.GetObjectValues(entity).Where(property => notIgnoredColumns.Any(c => c.Name == property.Key)))

And it will fetch whole data while a empty IPredicate,so it would better to add a IPredicate when predicates is empty.

Thank you.