SQLHelper.DB 4.0.180

There is a newer version of this package available.
See the version list below for details.
dotnet add package SQLHelper.DB --version 4.0.180
                    
NuGet\Install-Package SQLHelper.DB -Version 4.0.180
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SQLHelper.DB" Version="4.0.180" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLHelper.DB" Version="4.0.180" />
                    
Directory.Packages.props
<PackageReference Include="SQLHelper.DB" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SQLHelper.DB --version 4.0.180
                    
#r "nuget: SQLHelper.DB, 4.0.180"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SQLHelper.DB@4.0.180
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SQLHelper.DB&version=4.0.180
                    
Install as a Cake Addin
#tool nuget:?package=SQLHelper.DB&version=4.0.180
                    
Install as a Cake Tool

SQLHelper

Build status

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:

  1. 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 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
5.0.95 515 11/18/2025
5.0.94 375 11/18/2025
5.0.93 371 11/18/2025
5.0.92 390 11/14/2025
5.0.91 367 11/13/2025
5.0.90 270 11/13/2025
5.0.89 471 11/6/2025
5.0.88 325 10/31/2025
5.0.87 463 10/17/2025
5.0.86 169 10/17/2025
5.0.85 259 10/16/2025
5.0.84 270 10/15/2025
5.0.83 176 10/15/2025
5.0.82 171 10/15/2025
5.0.81 296 10/14/2025
5.0.80 172 10/14/2025
5.0.79 275 10/13/2025
5.0.78 179 10/12/2025
5.0.77 181 10/12/2025
5.0.76 523 9/30/2025
5.0.75 328 9/29/2025
5.0.74 305 9/25/2025
5.0.73 553 9/18/2025
5.0.72 413 9/17/2025
5.0.71 331 9/11/2025
5.0.70 230 9/10/2025
5.0.69 171 9/10/2025
5.0.68 170 9/10/2025
5.0.67 697 8/19/2025
5.0.66 182 8/19/2025
5.0.65 174 8/19/2025
5.0.64 176 8/19/2025
5.0.63 172 8/19/2025
5.0.62 326 8/18/2025
5.0.61 336 8/15/2025
5.0.60 435 8/6/2025
5.0.59 402 8/5/2025
5.0.58 272 8/5/2025
5.0.57 273 8/5/2025
5.0.56 247 8/5/2025
5.0.55 256 8/5/2025
5.0.54 396 8/4/2025
5.0.53 174 8/4/2025
5.0.52 461 7/28/2025
5.0.51 359 7/17/2025
5.0.50 450 7/14/2025
5.0.46 633 6/30/2025
5.0.45 198 6/30/2025
5.0.44 504 6/27/2025
5.0.43 293 6/27/2025
5.0.42 317 6/26/2025
5.0.41 306 6/18/2025
5.0.39 417 6/10/2025
5.0.38 305 5/30/2025
5.0.37 280 5/23/2025
5.0.36 371 5/14/2025
5.0.34 259 5/2/2025
5.0.33 299 4/28/2025
5.0.32 376 4/10/2025
5.0.30 327 3/15/2025
5.0.28 340 2/24/2025
5.0.27 694 2/12/2025
5.0.25 453 2/3/2025
5.0.24 348 1/30/2025
5.0.23 277 1/29/2025
5.0.22 335 1/24/2025
5.0.21 321 1/22/2025
5.0.20 312 1/16/2025
5.0.19 207 1/15/2025
5.0.15 274 1/13/2025
5.0.14 285 1/9/2025
5.0.13 499 12/17/2024
5.0.12 358 12/10/2024
5.0.11 183 12/10/2024
5.0.10 178 12/10/2024
5.0.9 255 12/9/2024
5.0.8 443 11/26/2024
5.0.7 172 11/26/2024
5.0.6 386 11/24/2024
5.0.5 181 11/24/2024
5.0.4 223 11/23/2024
4.0.218 305 11/20/2024
4.0.217 210 11/12/2024
4.0.216 389 11/11/2024
4.0.215 249 11/6/2024
4.0.214 324 11/5/2024
4.0.213 254 11/4/2024
4.0.212 279 11/1/2024
4.0.211 248 10/31/2024
4.0.210 255 10/30/2024
4.0.209 232 10/29/2024
4.0.208 328 10/25/2024
4.0.207 347 10/21/2024
4.0.206 307 10/16/2024
4.0.205 327 10/11/2024
4.0.204 259 10/10/2024
4.0.203 264 10/9/2024
4.0.202 358 10/2/2024
4.0.201 279 10/1/2024
4.0.200 297 9/30/2024
4.0.199 337 9/24/2024
4.0.198 296 9/23/2024
4.0.197 340 9/17/2024
4.0.196 351 9/10/2024
4.0.195 357 9/6/2024
4.0.194 371 9/3/2024
4.0.193 373 8/30/2024
4.0.192 275 8/29/2024
4.0.191 267 8/28/2024
4.0.190 279 8/27/2024
4.0.189 289 8/26/2024
4.0.188 301 8/23/2024
4.0.187 378 8/21/2024
4.0.186 538 8/16/2024
4.0.185 282 8/15/2024
4.0.184 302 8/14/2024
4.0.183 297 8/5/2024
4.0.182 274 8/2/2024
4.0.181 275 8/1/2024
4.0.180 371 7/26/2024
4.0.179 312 7/24/2024
4.0.178 348 7/11/2024
4.0.177 273 7/10/2024
4.0.176 187 7/10/2024
4.0.175 316 7/9/2024
4.0.174 444 7/5/2024
4.0.173 332 7/2/2024
4.0.172 402 6/27/2024
4.0.171 287 6/26/2024
4.0.170 374 6/24/2024
4.0.169 1,466 6/19/2024
4.0.168 283 6/18/2024
4.0.167 309 6/17/2024
4.0.166 314 6/14/2024
4.0.165 281 6/13/2024
4.0.164 422 6/3/2024
4.0.163 288 5/31/2024
4.0.162 288 5/30/2024
4.0.161 292 5/29/2024
4.0.160 506 5/27/2024
4.0.159 364 5/23/2024
4.0.158 372 5/21/2024
4.0.157 342 5/17/2024
4.0.156 266 5/16/2024
4.0.155 285 5/15/2024
4.0.154 329 5/8/2024
4.0.153 291 5/7/2024
4.0.152 293 5/6/2024
4.0.151 283 5/3/2024
4.0.150 1,007 5/2/2024
4.0.149 299 5/1/2024
4.0.148 298 4/30/2024
4.0.147 345 4/29/2024
4.0.146 319 4/25/2024
4.0.145 404 4/16/2024
4.0.144 322 4/12/2024
4.0.143 270 4/12/2024
4.0.142 287 4/11/2024
4.0.141 317 4/10/2024
4.0.140 284 4/9/2024
4.0.139 391 4/1/2024
4.0.138 329 3/29/2024
4.0.137 346 3/26/2024
4.0.136 317 3/22/2024
4.0.135 208 3/22/2024
4.0.134 381 3/18/2024
4.0.133 298 3/15/2024
4.0.132 281 3/14/2024
4.0.131 316 3/13/2024
4.0.130 315 3/11/2024
4.0.129 285 3/8/2024
4.0.128 251 3/7/2024
4.0.127 221 3/6/2024
4.0.126 223 3/5/2024
4.0.125 236 3/4/2024
4.0.124 1,749 3/1/2024
4.0.123 311 2/29/2024
4.0.122 194 2/28/2024
4.0.121 235 2/27/2024
4.0.120 450 2/26/2024
4.0.119 189 2/23/2024
4.0.118 215 2/22/2024
4.0.117 215 2/21/2024
4.0.116 221 2/20/2024
4.0.115 202 2/20/2024
4.0.114 1,064 2/19/2024
4.0.113 212 2/19/2024
4.0.112 335 2/16/2024
4.0.111 199 2/15/2024
4.0.110 237 2/14/2024
4.0.109 470 2/13/2024
4.0.108 299 2/12/2024
4.0.107 225 2/9/2024
4.0.106 356 2/8/2024
4.0.105 193 2/7/2024
4.0.104 191 2/7/2024
4.0.103 191 2/6/2024
4.0.102 1,021 2/2/2024
4.0.101 260 2/1/2024
4.0.100 198 2/1/2024
4.0.99 199 1/31/2024
4.0.98 194 1/30/2024
4.0.97 693 1/25/2024
4.0.96 274 1/24/2024
4.0.95 211 1/23/2024
4.0.94 1,726 1/16/2024
4.0.93 195 1/16/2024
4.0.92 309 1/15/2024
4.0.91 322 1/12/2024
4.0.90 191 1/11/2024
4.0.89 193 1/10/2024
4.0.88 704 1/8/2024
4.0.87 802 12/26/2023
4.0.86 195 12/26/2023
4.0.85 199 12/25/2023
4.0.84 538 12/22/2023
4.0.83 434 12/15/2023
4.0.82 206 12/14/2023
4.0.81 194 12/14/2023
4.0.80 220 12/13/2023
4.0.79 198 12/12/2023
4.0.78 1,179 12/11/2023
4.0.77 367 12/6/2023
4.0.76 363 12/5/2023
4.0.75 562 11/24/2023
4.0.74 402 11/21/2023
4.0.73 356 11/20/2023
4.0.72 252 11/20/2023
4.0.71 320 11/17/2023
4.0.70 783 11/16/2023
4.0.69 277 11/14/2023
4.0.68 409 11/9/2023
4.0.67 346 11/8/2023
4.0.66 288 11/7/2023
4.0.65 271 11/6/2023
4.0.64 307 11/3/2023
4.0.63 423 11/1/2023
4.0.62 186 11/1/2023
4.0.61 350 10/31/2023
4.0.60 325 10/30/2023
4.0.59 294 10/27/2023
4.0.58 305 10/26/2023
4.0.57 284 10/25/2023
4.0.56 289 10/17/2023
4.0.55 386 10/16/2023
4.0.54 410 10/12/2023
4.0.53 293 10/11/2023
4.0.52 339 10/5/2023
4.0.51 382 9/26/2023
4.0.50 410 9/22/2023
4.0.49 301 9/20/2023
4.0.48 280 9/19/2023
4.0.47 175 9/19/2023
4.0.46 356 9/18/2023
4.0.45 404 9/14/2023
4.0.44 305 9/13/2023
4.0.43 306 9/12/2023
4.0.42 342 9/11/2023
4.0.41 211 9/11/2023
4.0.40 290 9/11/2023
4.0.39 534 9/7/2023
4.0.38 319 9/6/2023
4.0.37 376 9/5/2023
4.0.36 216 9/5/2023
4.0.35 351 9/4/2023
4.0.34 403 9/1/2023
4.0.33 371 8/31/2023
4.0.32 348 8/30/2023
4.0.31 205 8/30/2023
4.0.30 373 8/29/2023
4.0.29 550 8/25/2023
4.0.28 476 8/23/2023
4.0.27 474 8/18/2023
4.0.26 324 8/17/2023
4.0.25 207 8/17/2023
4.0.24 210 8/17/2023
4.0.23 645 8/10/2023
4.0.22 350 8/9/2023
4.0.21 318 8/8/2023
4.0.20 236 8/8/2023
4.0.19 411 8/8/2023
4.0.18 497 8/7/2023
4.0.17 599 8/3/2023
4.0.16 531 7/26/2023
4.0.15 483 7/20/2023
4.0.14 509 7/18/2023
4.0.13 240 7/18/2023
4.0.12 234 7/18/2023
4.0.11 825 7/17/2023
4.0.10 249 7/14/2023
4.0.9 247 7/13/2023
4.0.8 230 7/13/2023
4.0.7 258 7/12/2023
4.0.6 252 7/12/2023
4.0.5 312 6/13/2023
4.0.4 1,561 1/30/2023
4.0.3 656 1/30/2023
4.0.2 660 1/27/2023
4.0.1 832 12/13/2022
4.0.0 640 12/12/2022
3.1.49 2,891 6/10/2022
3.1.47 1,974 4/20/2022
3.1.46 913 2/25/2022
3.1.45 2,179 1/11/2022
3.1.44 1,246 1/10/2022
3.1.43 1,261 10/12/2021
3.1.42 558 10/12/2021
3.1.41 1,891 6/17/2021
3.1.40 1,459 6/16/2021
3.1.39 1,315 6/16/2021
3.1.38 1,149 6/16/2021
3.1.37 863 6/15/2021
3.1.35 2,104 1/7/2021
3.1.34 1,560 12/16/2020
3.1.33 710 12/16/2020
3.1.32 1,372 12/14/2020
3.1.31 3,498 9/13/2020
3.1.30 1,898 6/19/2020
3.1.29 1,312 6/8/2020
3.1.28 2,678 5/12/2020
3.1.27 2,145 5/12/2020
3.1.26 1,659 4/28/2020
3.1.25 1,593 4/16/2020
3.1.23 1,514 4/16/2020
3.1.22 1,576 4/16/2020
3.1.21 1,294 4/15/2020
3.1.20 1,534 4/15/2020
3.1.19 1,598 4/14/2020
3.1.18 1,289 4/14/2020
3.1.17 759 4/14/2020
3.1.16 1,614 4/10/2020
3.1.15 1,619 4/10/2020
3.1.14 4,130 3/26/2020
3.1.13 1,648 3/26/2020
3.1.12 1,837 3/25/2020
3.1.11 1,300 3/25/2020
3.1.10 1,288 3/25/2020
3.1.9 1,772 3/25/2020
3.1.8 1,826 3/24/2020
3.1.7 2,495 3/21/2020
3.1.6 2,345 3/13/2020
3.1.5 1,330 3/13/2020
3.1.3 2,328 2/28/2020
3.1.1.2 756 2/28/2020
3.1.1 1,084 2/22/2020
3.1.0 1,348 2/21/2020
3.0.4 1,407 2/11/2020
3.0.3 1,073 2/11/2020
3.0.2 835 2/10/2020
3.0.1 1,814 1/9/2020
3.0.0 1,548 12/23/2019
2.0.18 2,830 6/19/2019
2.0.17 851 6/19/2019
2.0.16 2,358 4/17/2019
2.0.15 1,741 3/14/2019
2.0.14 914 2/22/2019
2.0.13 1,952 2/21/2019
2.0.12 890 2/21/2019
2.0.11 4,912 8/1/2018
2.0.10 1,982 8/1/2018
2.0.9 1,738 7/3/2018
2.0.8 2,277 6/26/2018
2.0.7 1,465 6/26/2018
2.0.6 2,059 6/14/2018
2.0.5 2,186 6/1/2018
2.0.4 2,482 5/22/2018
2.0.3 3,078 5/9/2018
2.0.2 2,707 2/15/2018
2.0.1 2,366 2/13/2018
2.0.0 3,160 1/2/2018
1.0.44 11,866 10/10/2017
1.0.42 1,252 10/10/2017
1.0.41 1,560 9/29/2017
1.0.40 4,683 9/19/2017
1.0.39 1,273 9/15/2017
1.0.36 1,253 9/15/2017
1.0.35 1,250 9/15/2017
1.0.34 3,665 7/3/2017
1.0.33 2,176 6/16/2017
1.0.32 2,170 6/16/2017
1.0.31 1,309 5/30/2017
1.0.28 2,040 5/30/2017
1.0.27 1,816 5/25/2017
1.0.26 2,080 5/24/2017
1.0.25 1,639 5/19/2017
1.0.24 1,325 5/19/2017
1.0.23 1,612 5/17/2017
1.0.20 1,420 5/8/2017
1.0.19 1,431 4/7/2017
1.0.18 2,057 3/22/2017
1.0.15 1,777 1/31/2017
1.0.14 1,432 1/24/2017
1.0.13 1,471 1/8/2017
1.0.12 1,437 1/6/2017
1.0.11 1,451 1/6/2017
1.0.10 1,407 1/3/2017
1.0.9 1,535 12/9/2016
1.0.8 1,364 12/1/2016
1.0.0 1,336 9/15/2017