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

Get by id creates empty predicate. #314

Open kspdrgn opened 1 year ago

kspdrgn commented 1 year ago

The test case on master currently works because there is only 1 row in the database, so select without a where returns 1 row as expected.

Added breaking test case for SQL Server Get, though this bug may affect all providers.

The predicate is not filled out when using Get(value) but they work when using Get(object). I noticed that in DapperImplementor.GetMapAndPredicate, GetKeyPredicate is only called for Update and Delete, not Get.

This pull request does not fix anything, it will start to fail the build because this is a bug.

Workaround for developers trying to use Get is to use Get(new {}) syntax.

Workaround for Dapper-Extensions is to fix the documentation to say Get(new { id }) instead of Get(id).