SQLHelper.DB
4.0.191
See the version list below for details.
dotnet add package SQLHelper.DB --version 4.0.191
NuGet\Install-Package SQLHelper.DB -Version 4.0.191
<PackageReference Include="SQLHelper.DB" Version="4.0.191" />
paket add SQLHelper.DB --version 4.0.191
#r "nuget: SQLHelper.DB, 4.0.191"
// Install SQLHelper.DB as a Cake Addin #addin nuget:?package=SQLHelper.DB&version=4.0.191 // Install SQLHelper.DB as a Cake Tool #tool nuget:?package=SQLHelper.DB&version=4.0.191
SQLHelper
SQLHelper is a simple class to help with running queries against a database.
Basic Usage
In order to use the system, you do need register it with your ServiceCollection:
serviceCollection.AddCanisterModules();
This is required prior to using the SQLHelper class for the first time. Once Canister is set up, you can use the SQLHelper class:
var Configuration = new ConfigurationBuilder()
.AddInMemoryCollection()
.Build();
var Instance = new SQLHelper(Configuration, SqlClientFactory.Instance, "ConnectionString");
Or simply ask for an instance using dependency injection:
public MyClass(SQLHelper helper) { ... }
The SQLHelper class takes in a IConfiguration class, a DbProviderFactory class, and the connection string. The connection string can just be the name of a connection string in your configuration object. Once an instance is set up, you can create a batch, add queries, and then execute them.
var Results = Instance.CreateBatch()
.AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable]")
.AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable2]")
.AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable3]")
.Execute();
The Results object then holds the results for all 3 queries and is returned as IList<IList<dynamic>>. So in order to get the results from the queries:
var FirstQueryResults = Results[0];
var SecondQueryResults = Results[1];
var ThirdQueryResults = Results[2];
It is also possible to convert the results from the dynamic type to a class type that you specify:
var TestTableClasses = FirstQueryResults.Select(x => (TestTableClass)x).ToList();
The type will be converted automatically for you with no special type conversion required. SQLHelper also has an ExecuteScalar function:
var Result = Instance.ExecuteScalar<int>();
This will either return the first value of the first set of results OR it will return the number of rows that were effected depending on whether or not the query was a select or not.
Installation
The library is available via Nuget with the package name "SQLHelper.DB". To install it run the following command in the Package Manager Console:
Install-Package SQLHelper.DB
Build Process
In order to build the library you will require the following as a minimum:
- Visual Studio 2022
Other than that, just clone the project and you should be able to load the solution and build without too much effort.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- BigBook (>= 5.1.52)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.ObjectPool (>= 8.0.8)
- Microsoft.SqlServer.Management.SqlParser (>= 172.0.1)
- SQLParser (>= 3.0.19)
- System.Data.Common (>= 4.3.0)
- System.Dynamic.Runtime (>= 4.3.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SQLHelper.DB:
Package | Downloads |
---|---|
Data.Modeler
Data.Modeler helps to model database schemas using C#. |
|
Holmes
Holmes is a database analysis library designed to suggest improvements and optimizations. Supports .Net Core as well as full .Net. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.0.193 | 57 | 8/30/2024 |
4.0.192 | 62 | 8/29/2024 |
4.0.191 | 84 | 8/28/2024 |
4.0.190 | 102 | 8/27/2024 |
4.0.189 | 114 | 8/26/2024 |
4.0.188 | 128 | 8/23/2024 |
4.0.187 | 180 | 8/21/2024 |
4.0.186 | 258 | 8/16/2024 |
4.0.185 | 112 | 8/15/2024 |
4.0.184 | 124 | 8/14/2024 |
4.0.183 | 135 | 8/5/2024 |
4.0.182 | 103 | 8/2/2024 |
4.0.181 | 118 | 8/1/2024 |
4.0.180 | 145 | 7/26/2024 |
4.0.179 | 124 | 7/24/2024 |
4.0.178 | 198 | 7/11/2024 |
4.0.177 | 118 | 7/10/2024 |
4.0.176 | 79 | 7/10/2024 |
4.0.175 | 136 | 7/9/2024 |
4.0.174 | 239 | 7/5/2024 |
4.0.173 | 186 | 7/2/2024 |
4.0.172 | 223 | 6/27/2024 |
4.0.171 | 146 | 6/26/2024 |
4.0.170 | 194 | 6/24/2024 |
4.0.169 | 623 | 6/19/2024 |
4.0.168 | 151 | 6/18/2024 |
4.0.167 | 150 | 6/17/2024 |
4.0.166 | 152 | 6/14/2024 |
4.0.165 | 135 | 6/13/2024 |
4.0.164 | 231 | 6/3/2024 |
4.0.163 | 161 | 5/31/2024 |
4.0.162 | 146 | 5/30/2024 |
4.0.161 | 139 | 5/29/2024 |
4.0.160 | 180 | 5/27/2024 |
4.0.159 | 178 | 5/23/2024 |
4.0.158 | 180 | 5/21/2024 |
4.0.157 | 171 | 5/17/2024 |
4.0.156 | 135 | 5/16/2024 |
4.0.155 | 144 | 5/15/2024 |
4.0.154 | 194 | 5/8/2024 |
4.0.153 | 157 | 5/7/2024 |
4.0.152 | 161 | 5/6/2024 |
4.0.151 | 149 | 5/3/2024 |
4.0.150 | 583 | 5/2/2024 |
4.0.149 | 149 | 5/1/2024 |
4.0.148 | 158 | 4/30/2024 |
4.0.147 | 173 | 4/29/2024 |
4.0.146 | 167 | 4/25/2024 |
4.0.145 | 213 | 4/16/2024 |
4.0.144 | 157 | 4/12/2024 |
4.0.143 | 122 | 4/12/2024 |
4.0.142 | 140 | 4/11/2024 |
4.0.141 | 148 | 4/10/2024 |
4.0.140 | 144 | 4/9/2024 |
4.0.139 | 201 | 4/1/2024 |
4.0.138 | 192 | 3/29/2024 |
4.0.137 | 171 | 3/26/2024 |
4.0.136 | 160 | 3/22/2024 |
4.0.135 | 88 | 3/22/2024 |
4.0.134 | 202 | 3/18/2024 |
4.0.133 | 149 | 3/15/2024 |
4.0.132 | 141 | 3/14/2024 |
4.0.131 | 164 | 3/13/2024 |
4.0.130 | 163 | 3/11/2024 |
4.0.129 | 147 | 3/8/2024 |
4.0.128 | 130 | 3/7/2024 |
4.0.127 | 103 | 3/6/2024 |
4.0.126 | 123 | 3/5/2024 |
4.0.125 | 114 | 3/4/2024 |
4.0.124 | 1,011 | 3/1/2024 |
4.0.123 | 154 | 2/29/2024 |
4.0.122 | 99 | 2/28/2024 |
4.0.121 | 122 | 2/27/2024 |
4.0.120 | 228 | 2/26/2024 |
4.0.119 | 103 | 2/23/2024 |
4.0.118 | 106 | 2/22/2024 |
4.0.117 | 96 | 2/21/2024 |
4.0.116 | 105 | 2/20/2024 |
4.0.115 | 89 | 2/20/2024 |
4.0.114 | 555 | 2/19/2024 |
4.0.113 | 100 | 2/19/2024 |
4.0.112 | 156 | 2/16/2024 |
4.0.111 | 105 | 2/15/2024 |
4.0.110 | 109 | 2/14/2024 |
4.0.109 | 256 | 2/13/2024 |
4.0.108 | 147 | 2/12/2024 |
4.0.107 | 110 | 2/9/2024 |
4.0.106 | 169 | 2/8/2024 |
4.0.105 | 88 | 2/7/2024 |
4.0.104 | 89 | 2/7/2024 |
4.0.103 | 87 | 2/6/2024 |
4.0.102 | 532 | 2/2/2024 |
4.0.101 | 132 | 2/1/2024 |
4.0.100 | 89 | 2/1/2024 |
4.0.99 | 97 | 1/31/2024 |
4.0.98 | 92 | 1/30/2024 |
4.0.97 | 351 | 1/25/2024 |
4.0.96 | 125 | 1/24/2024 |
4.0.95 | 96 | 1/23/2024 |
4.0.94 | 951 | 1/16/2024 |
4.0.93 | 90 | 1/16/2024 |
4.0.92 | 161 | 1/15/2024 |
4.0.91 | 162 | 1/12/2024 |
4.0.90 | 100 | 1/11/2024 |
4.0.89 | 102 | 1/10/2024 |
4.0.88 | 389 | 1/8/2024 |
4.0.87 | 492 | 12/26/2023 |
4.0.86 | 86 | 12/26/2023 |
4.0.85 | 93 | 12/25/2023 |
4.0.84 | 282 | 12/22/2023 |
4.0.83 | 249 | 12/15/2023 |
4.0.82 | 99 | 12/14/2023 |
4.0.81 | 82 | 12/14/2023 |
4.0.80 | 108 | 12/13/2023 |
4.0.79 | 98 | 12/12/2023 |
4.0.78 | 639 | 12/11/2023 |
4.0.77 | 250 | 12/6/2023 |
4.0.76 | 195 | 12/5/2023 |
4.0.75 | 320 | 11/24/2023 |
4.0.74 | 210 | 11/21/2023 |
4.0.73 | 193 | 11/20/2023 |
4.0.72 | 168 | 11/20/2023 |
4.0.71 | 169 | 11/17/2023 |
4.0.70 | 390 | 11/16/2023 |
4.0.69 | 146 | 11/14/2023 |
4.0.68 | 205 | 11/9/2023 |
4.0.67 | 188 | 11/8/2023 |
4.0.66 | 161 | 11/7/2023 |
4.0.65 | 156 | 11/6/2023 |
4.0.64 | 165 | 11/3/2023 |
4.0.63 | 226 | 11/1/2023 |
4.0.62 | 107 | 11/1/2023 |
4.0.61 | 187 | 10/31/2023 |
4.0.60 | 178 | 10/30/2023 |
4.0.59 | 163 | 10/27/2023 |
4.0.58 | 159 | 10/26/2023 |
4.0.57 | 160 | 10/25/2023 |
4.0.56 | 168 | 10/17/2023 |
4.0.55 | 210 | 10/16/2023 |
4.0.54 | 227 | 10/12/2023 |
4.0.53 | 161 | 10/11/2023 |
4.0.52 | 206 | 10/5/2023 |
4.0.51 | 232 | 9/26/2023 |
4.0.50 | 227 | 9/22/2023 |
4.0.49 | 177 | 9/20/2023 |
4.0.48 | 155 | 9/19/2023 |
4.0.47 | 97 | 9/19/2023 |
4.0.46 | 195 | 9/18/2023 |
4.0.45 | 233 | 9/14/2023 |
4.0.44 | 164 | 9/13/2023 |
4.0.43 | 166 | 9/12/2023 |
4.0.42 | 207 | 9/11/2023 |
4.0.41 | 117 | 9/11/2023 |
4.0.40 | 170 | 9/11/2023 |
4.0.39 | 308 | 9/7/2023 |
4.0.38 | 175 | 9/6/2023 |
4.0.37 | 220 | 9/5/2023 |
4.0.36 | 123 | 9/5/2023 |
4.0.35 | 190 | 9/4/2023 |
4.0.34 | 227 | 9/1/2023 |
4.0.33 | 228 | 8/31/2023 |
4.0.32 | 195 | 8/30/2023 |
4.0.31 | 117 | 8/30/2023 |
4.0.30 | 224 | 8/29/2023 |
4.0.29 | 316 | 8/25/2023 |
4.0.28 | 279 | 8/23/2023 |
4.0.27 | 276 | 8/18/2023 |
4.0.26 | 182 | 8/17/2023 |
4.0.25 | 110 | 8/17/2023 |
4.0.24 | 114 | 8/17/2023 |
4.0.23 | 364 | 8/10/2023 |
4.0.22 | 205 | 8/9/2023 |
4.0.21 | 195 | 8/8/2023 |
4.0.20 | 138 | 8/8/2023 |
4.0.19 | 245 | 8/8/2023 |
4.0.18 | 298 | 8/7/2023 |
4.0.17 | 397 | 8/3/2023 |
4.0.16 | 325 | 7/26/2023 |
4.0.15 | 297 | 7/20/2023 |
4.0.14 | 294 | 7/18/2023 |
4.0.13 | 146 | 7/18/2023 |
4.0.12 | 130 | 7/18/2023 |
4.0.11 | 472 | 7/17/2023 |
4.0.10 | 139 | 7/14/2023 |
4.0.9 | 144 | 7/13/2023 |
4.0.8 | 135 | 7/13/2023 |
4.0.7 | 145 | 7/12/2023 |
4.0.6 | 140 | 7/12/2023 |
4.0.5 | 192 | 6/13/2023 |
4.0.4 | 934 | 1/30/2023 |
4.0.3 | 486 | 1/30/2023 |
4.0.2 | 484 | 1/27/2023 |
4.0.1 | 654 | 12/13/2022 |
4.0.0 | 474 | 12/12/2022 |
3.1.49 | 2,573 | 6/10/2022 |
3.1.47 | 1,744 | 4/20/2022 |
3.1.46 | 765 | 2/25/2022 |
3.1.45 | 1,942 | 1/11/2022 |
3.1.44 | 1,018 | 1/10/2022 |
3.1.43 | 1,083 | 10/12/2021 |
3.1.42 | 427 | 10/12/2021 |
3.1.41 | 1,594 | 6/17/2021 |
3.1.40 | 1,199 | 6/16/2021 |
3.1.39 | 1,092 | 6/16/2021 |
3.1.38 | 913 | 6/16/2021 |
3.1.37 | 697 | 6/15/2021 |
3.1.35 | 1,846 | 1/7/2021 |
3.1.34 | 1,297 | 12/16/2020 |
3.1.33 | 540 | 12/16/2020 |
3.1.32 | 1,119 | 12/14/2020 |
3.1.31 | 3,052 | 9/13/2020 |
3.1.30 | 1,612 | 6/19/2020 |
3.1.29 | 1,109 | 6/8/2020 |
3.1.28 | 2,319 | 5/12/2020 |
3.1.27 | 1,839 | 5/12/2020 |
3.1.26 | 1,377 | 4/28/2020 |
3.1.25 | 1,332 | 4/16/2020 |
3.1.23 | 1,270 | 4/16/2020 |
3.1.22 | 1,310 | 4/16/2020 |
3.1.21 | 1,068 | 4/15/2020 |
3.1.20 | 1,283 | 4/15/2020 |
3.1.19 | 1,359 | 4/14/2020 |
3.1.18 | 1,069 | 4/14/2020 |
3.1.17 | 581 | 4/14/2020 |
3.1.16 | 1,354 | 4/10/2020 |
3.1.15 | 1,382 | 4/10/2020 |
3.1.14 | 3,715 | 3/26/2020 |
3.1.13 | 1,397 | 3/26/2020 |
3.1.12 | 1,573 | 3/25/2020 |
3.1.11 | 1,063 | 3/25/2020 |
3.1.10 | 1,052 | 3/25/2020 |
3.1.9 | 1,501 | 3/25/2020 |
3.1.8 | 1,566 | 3/24/2020 |
3.1.7 | 2,172 | 3/21/2020 |
3.1.6 | 2,066 | 3/13/2020 |
3.1.5 | 1,082 | 3/13/2020 |
3.1.3 | 2,015 | 2/28/2020 |
3.1.1.2 | 586 | 2/28/2020 |
3.1.1 | 895 | 2/22/2020 |
3.1.0 | 1,120 | 2/21/2020 |
3.0.4 | 1,181 | 2/11/2020 |
3.0.3 | 848 | 2/11/2020 |
3.0.2 | 651 | 2/10/2020 |
3.0.1 | 1,576 | 1/9/2020 |
3.0.0 | 1,282 | 12/23/2019 |
2.0.18 | 2,204 | 6/19/2019 |
2.0.17 | 660 | 6/19/2019 |
2.0.16 | 2,024 | 4/17/2019 |
2.0.15 | 1,481 | 3/14/2019 |
2.0.14 | 720 | 2/22/2019 |
2.0.13 | 1,668 | 2/21/2019 |
2.0.12 | 696 | 2/21/2019 |
2.0.11 | 4,319 | 8/1/2018 |
2.0.10 | 1,574 | 8/1/2018 |
2.0.9 | 1,278 | 7/3/2018 |
2.0.8 | 1,723 | 6/26/2018 |
2.0.7 | 1,009 | 6/26/2018 |
2.0.6 | 1,535 | 6/14/2018 |
2.0.5 | 1,607 | 6/1/2018 |
2.0.4 | 1,910 | 5/22/2018 |
2.0.3 | 2,504 | 5/9/2018 |
2.0.2 | 2,180 | 2/15/2018 |
2.0.1 | 1,810 | 2/13/2018 |
2.0.0 | 2,507 | 1/2/2018 |
1.0.44 | 10,845 | 10/10/2017 |
1.0.42 | 913 | 10/10/2017 |
1.0.41 | 1,199 | 9/29/2017 |
1.0.40 | 4,112 | 9/19/2017 |
1.0.39 | 931 | 9/15/2017 |
1.0.36 | 917 | 9/15/2017 |
1.0.35 | 906 | 9/15/2017 |
1.0.34 | 3,118 | 7/3/2017 |
1.0.33 | 1,728 | 6/16/2017 |
1.0.32 | 1,676 | 6/16/2017 |
1.0.31 | 968 | 5/30/2017 |
1.0.28 | 1,589 | 5/30/2017 |
1.0.27 | 1,389 | 5/25/2017 |
1.0.26 | 1,621 | 5/24/2017 |
1.0.25 | 1,253 | 5/19/2017 |
1.0.24 | 968 | 5/19/2017 |
1.0.23 | 1,241 | 5/17/2017 |
1.0.20 | 1,080 | 5/8/2017 |
1.0.19 | 1,116 | 4/7/2017 |
1.0.18 | 1,636 | 3/22/2017 |
1.0.15 | 1,394 | 1/31/2017 |
1.0.14 | 1,097 | 1/24/2017 |
1.0.13 | 1,103 | 1/8/2017 |
1.0.12 | 1,064 | 1/6/2017 |
1.0.11 | 1,085 | 1/6/2017 |
1.0.10 | 1,058 | 1/3/2017 |
1.0.9 | 1,185 | 12/9/2016 |
1.0.8 | 1,027 | 12/1/2016 |
1.0.0 | 986 | 9/15/2017 |