API Proposal - example code included
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
public static class ProposalExtensions
{
public static void JustShowMeTheCode(IDbConnection cn)
{
var result = cn.Query(
// allows to use anonymous type as result
template: new { EmployeeName = "" },
param: new { EmployeeAge = 26 },
// allows to use 'nameof' for column names and parameter names
sql: (t, p) => $"select e.name as {nameof(t.EmployeeName)} from tbl_emp e where e.age>@{nameof(p.EmployeeAge)}");
foreach (var item in result)
{
Console.WriteLine(item.EmployeeName);
}
}
public static IEnumerable<T> Query<T,TParams>(this IDbConnection cnn, T template, Func<T,TParams,string> sql, TParams param, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
return cnn.Query<T>(sql(default(T),default(TParams)),param,transaction,buffered,commandTimeout,commandType);
}
public static IEnumerable<T> Query<T>(this IDbConnection cnn, T template, Func<T,string> sql, IDbTransaction? transaction = null, bool buffered = true, int? commandTimeout = null, CommandType? commandType = null)
{
return cnn.Query<T>(sql(default(T)), param:null, transaction, buffered, commandTimeout, commandType);
}
}
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 reviewing the IDbConnection Query extension examples shown in the issue and the proposed overload signatures. The issue does not name repository files, tests, or acceptance criteria, so clarify the intended API and expected behavior before identifying an implementation location or defining what done means.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100