Skip to content

Commit 2568d6a

Browse files
author
electricessence
committed
Refactor to be more type inclusive.
Was relying on interfaces. Now the sub-type hierarchy allows for much broader use with extensions. All Async methods exposed to all Db classed not just Sql.
1 parent cb90e20 commit 2568d6a

6 files changed

Lines changed: 992 additions & 1140 deletions

File tree

Documentation.xml

Lines changed: 437 additions & 510 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ExpressiveDbCommand.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Data;
4+
using System.Data.Common;
35
using System.Linq;
6+
using System.Threading.Tasks;
47

58
namespace Open.Database.Extensions
69
{
7-
/// <summary>
8-
/// An abstraction for executing commands on a database using best practices and simplified expressive syntax.
9-
/// </summary>
10-
public class ExpressiveDbCommand : ExpressiveCommandBase<IDbConnection, IDbCommand, DbType, ExpressiveDbCommand>
10+
11+
/// <summary>
12+
/// A specialized for SqlClient abstraction for executing commands on a database using best practices and simplified expressive syntax.
13+
/// </summary>
14+
public class ExpressiveDbCommand : ExpressiveDbCommandBase<DbConnection, DbCommand, DbType, ExpressiveDbCommand>
1115
{
12-
/// <param name="connFactory">The factory to generate connections from.</param>
13-
/// <param name="type">The command type>.</param>
14-
/// <param name="command">The SQL command.</param>
15-
/// <param name="params">The list of params</param>
16-
public ExpressiveDbCommand(
17-
IDbConnectionFactory<IDbConnection> connFactory,
18-
CommandType type,
19-
string command,
20-
List<Param> @params = null)
21-
: base(connFactory, type, command, @params)
16+
/// <param name="connFactory">The factory to generate connections from.</param>
17+
/// <param name="type">The command type>.</param>
18+
/// <param name="command">The SQL command.</param>
19+
/// <param name="params">The list of params</param>
20+
public ExpressiveDbCommand(IDbConnectionFactory<DbConnection> connFactory, CommandType type, string command, List<Param> @params = null)
21+
: base(connFactory, type, command, @params)
2222
{
2323
}
2424

25-
/// <param name="connFactory">The factory to generate connections from.</param>
26-
/// <param name="type">The command type>.</param>
27-
/// <param name="command">The SQL command.</param>
28-
/// <param name="params">The list of params</param>
29-
protected ExpressiveDbCommand(
30-
IDbConnectionFactory<IDbConnection> connFactory,
31-
CommandType type,
32-
string command,
33-
params Param[] @params)
34-
: this(connFactory, type, command, @params.ToList())
25+
/// <param name="connFactory">The factory to generate connections from.</param>
26+
/// <param name="type">The command type>.</param>
27+
/// <param name="command">The SQL command.</param>
28+
/// <param name="params">The list of params</param>
29+
protected ExpressiveDbCommand(IDbConnectionFactory<DbConnection> connFactory, CommandType type, string command, params Param[] @params)
30+
: this(connFactory, type, command, @params.ToList())
3531
{
3632
}
3733

38-
/// <summary>
39-
/// Handles adding the list of parameters to a new command.
40-
/// </summary>
41-
/// <param name="command"></param>
42-
protected override void AddParams(IDbCommand command)
34+
/// <summary>
35+
/// Handles adding the list of parameters to a new command.
36+
/// </summary>
37+
/// <param name="command"></param>
38+
protected override void AddParams(DbCommand command)
4339
{
4440
foreach (var p in Params)
4541
{
4642
var np = command.AddParameter(p.Name, p.Value);
4743
if (p.Type.HasValue) np.DbType = p.Type.Value;
4844
}
4945
}
46+
5047
}
48+
5149
}

0 commit comments

Comments
 (0)