|
1 | | -using System.Collections.Generic; |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
2 | 3 | using System.Data; |
| 4 | +using System.Data.Common; |
3 | 5 | using System.Linq; |
| 6 | +using System.Threading.Tasks; |
4 | 7 |
|
5 | 8 | namespace Open.Database.Extensions |
6 | 9 | { |
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> |
11 | 15 | { |
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) |
22 | 22 | { |
23 | 23 | } |
24 | 24 |
|
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()) |
35 | 31 | { |
36 | 32 | } |
37 | 33 |
|
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) |
43 | 39 | { |
44 | 40 | foreach (var p in Params) |
45 | 41 | { |
46 | 42 | var np = command.AddParameter(p.Name, p.Value); |
47 | 43 | if (p.Type.HasValue) np.DbType = p.Type.Value; |
48 | 44 | } |
49 | 45 | } |
| 46 | + |
50 | 47 | } |
| 48 | + |
51 | 49 | } |
0 commit comments