DapperLib / DapperLib/Dapper.Contrib
Dapper should expose a .Count<T>() method
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
The implementation should be quite simple I believe, similar to how Get or GetAll are implemented. Here's the extension method I've been using:
public static int Count<T>(this IDbConnection connection)
{
return connection.QuerySingle<int>($"SELECT COUNT(1) FROM {typeof(T).Name}");
}
Obviously the real implementation would need to incorporate the TableAttribute
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Get and GetAll implementations and how TableAttribute is handled. Add a Count() extension on IDbConnection that uses the mapped table name and returns the row count; done means the method is exposed consistently with the other extensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100