ADO wrapper SQL database session
Facade class publishing all the interesting methods. Its' constructed with connection string of type "Data Source=...".
Fetched row data wrapper used to get rid of DataReader.
SQL parameter wrapper used to isolate concrete provider classes. It expects name, C# type and value
var parameter = new DbParameter("Id", typeof(int), 5)
// there is other way of creating parameter instance
var otherParameter = new DbParameter<int>("Id", 5)They are commonly aggregated to sets - any parameter set must contain parameter for each placeholder (e.g. parameter with name "Something" if there is placeholder "@Something" in a SQL script).
var parameterSet = new DbParameterSet
{
new SqlParameter<string>("Name", "Max"),
new SqlParameter<string>("Surname", "Example"),
new SqlParameter<int>("Age", 24)
}In case of executing batches there are IEnumerable to be inserted. The thing is that the same SQL script will be ran once with each parameter set in this enumeration (i.e. with different parameter values each time).
var parameterSetBatch = new DbParameterSet[]
{
new DbParameterSet
{
new SqlParameter<string>("Name", "Max"),
new SqlParameter<string>("Surname", "Example"),
new SqlParameter<int>("Age", 24)
},
new DbParameterSet
{
new SqlParameter<string>("Name", "Max"),
new SqlParameter<string>("Surname", "Example"),
new SqlParameter<int>("Age", 24)
}
}