-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSOQuery.cs
63 lines (50 loc) · 2.19 KB
/
PSOQuery.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Collections.Generic;
using System.Data;
namespace PSO.Database
{
public class PSOQuery
{
/// <summary>
/// The name of the connection string to use.
/// The router class will search the app.config for the corresponding string.
/// </summary>
public string ConnectionName { get; set; } = "";
/// <summary>
/// Either the text of the command to execute or the name of the stored procedure to execute.
/// </summary>
public string CommandString { get; set; } = "";
/// <summary>
/// Default value of IDbCommand execution timeout is 30s.
/// </summary>
public int TimeOutSeconds { get; set; } = 30;
/// <summary>
/// The values of the parameters passed to a stored procedure.
/// The order of values must match the order of the parameters specified in the procedure.
/// </summary>
public List<object> ParameterValues { get; set; } = new List<object>();
public CommandType CommandType { get; set; } = CommandType.StoredProcedure;
#region Constructors
public PSOQuery(string connectionName, string commandString)
{
ConnectionName = connectionName;
CommandString = commandString;
}
public PSOQuery(string connectionName, string commandString, IEnumerable<object> parameterValues) : this(connectionName, commandString)
{
ParameterValues.AddRange(parameterValues);
}
public PSOQuery(string connectionName, string commandString, CommandType type) : this(connectionName, commandString)
{
CommandType = type;
}
public PSOQuery(string connectionName, string commandString, CommandType type, IEnumerable<object> parameterValues) : this(connectionName, commandString, parameterValues)
{
CommandType = type;
}
public PSOQuery(string connectionName, string commandString, int timeOutSeconds, CommandType type, IEnumerable<object> parameterValues) : this(connectionName, commandString, type, parameterValues)
{
TimeOutSeconds = timeOutSeconds;
}
#endregion
}
}