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.100 334 12/11/2025
5.0.99 350 12/10/2025
5.0.98 311 12/10/2025
5.0.97 316 12/10/2025
5.0.96 675 12/1/2025
5.0.95 645 11/18/2025
5.0.94 388 11/18/2025
5.0.93 383 11/18/2025
5.0.92 402 11/14/2025
5.0.91 383 11/13/2025
5.0.90 281 11/13/2025
5.0.89 479 11/6/2025
5.0.88 334 10/31/2025
5.0.87 472 10/17/2025
5.0.86 176 10/17/2025
5.0.85 268 10/16/2025
5.0.84 281 10/15/2025
5.0.83 185 10/15/2025
5.0.82 179 10/15/2025
5.0.81 304 10/14/2025
5.0.80 181 10/14/2025
5.0.79 282 10/13/2025
5.0.78 185 10/12/2025
5.0.77 190 10/12/2025
5.0.76 528 9/30/2025
5.0.75 335 9/29/2025
5.0.74 312 9/25/2025
5.0.73 561 9/18/2025
5.0.72 420 9/17/2025
5.0.71 342 9/11/2025
5.0.70 239 9/10/2025
5.0.69 180 9/10/2025
5.0.68 180 9/10/2025
5.0.67 705 8/19/2025
5.0.66 189 8/19/2025
5.0.65 183 8/19/2025
5.0.64 184 8/19/2025
5.0.63 178 8/19/2025
5.0.62 333 8/18/2025
5.0.61 343 8/15/2025
5.0.60 442 8/6/2025
5.0.59 412 8/5/2025
5.0.58 278 8/5/2025
5.0.57 283 8/5/2025
5.0.56 256 8/5/2025
5.0.55 265 8/5/2025
5.0.54 402 8/4/2025
5.0.53 181 8/4/2025
5.0.52 469 7/28/2025
5.0.51 366 7/17/2025
5.0.50 457 7/14/2025
5.0.46 642 6/30/2025
5.0.45 206 6/30/2025
5.0.44 512 6/27/2025
5.0.43 300 6/27/2025
5.0.42 325 6/26/2025
5.0.41 316 6/18/2025
5.0.39 426 6/10/2025
5.0.38 312 5/30/2025
5.0.37 289 5/23/2025
5.0.36 379 5/14/2025
5.0.34 264 5/2/2025
5.0.33 308 4/28/2025
5.0.32 387 4/10/2025
5.0.30 335 3/15/2025
5.0.28 347 2/24/2025
5.0.27 702 2/12/2025
5.0.25 459 2/3/2025
5.0.24 356 1/30/2025
5.0.23 284 1/29/2025
5.0.22 343 1/24/2025
5.0.21 330 1/22/2025
5.0.20 319 1/16/2025
5.0.19 214 1/15/2025
5.0.15 281 1/13/2025
5.0.14 293 1/9/2025
5.0.13 505 12/17/2024
5.0.12 364 12/10/2024
5.0.11 195 12/10/2024
5.0.10 185 12/10/2024
5.0.9 262 12/9/2024
5.0.8 450 11/26/2024
5.0.7 178 11/26/2024
5.0.6 396 11/24/2024
5.0.5 191 11/24/2024
5.0.4 231 11/23/2024
4.0.218 313 11/20/2024
4.0.217 217 11/12/2024
4.0.216 394 11/11/2024
4.0.215 258 11/6/2024
4.0.214 331 11/5/2024
4.0.213 259 11/4/2024
4.0.212 289 11/1/2024
4.0.211 257 10/31/2024
4.0.210 264 10/30/2024
4.0.209 239 10/29/2024
4.0.208 338 10/25/2024
4.0.207 353 10/21/2024
4.0.206 314 10/16/2024
4.0.205 334 10/11/2024
4.0.204 265 10/10/2024
4.0.203 270 10/9/2024
4.0.202 364 10/2/2024
4.0.201 288 10/1/2024
4.0.200 307 9/30/2024
4.0.199 345 9/24/2024
4.0.198 304 9/23/2024
4.0.197 348 9/17/2024
4.0.196 359 9/10/2024
4.0.195 363 9/6/2024
4.0.194 378 9/3/2024
4.0.193 379 8/30/2024
4.0.192 281 8/29/2024
4.0.191 272 8/28/2024
4.0.190 284 8/27/2024
4.0.189 293 8/26/2024
4.0.188 306 8/23/2024
4.0.187 385 8/21/2024
4.0.186 542 8/16/2024
4.0.185 288 8/15/2024
4.0.184 308 8/14/2024
4.0.183 304 8/5/2024
4.0.182 282 8/2/2024
4.0.181 284 8/1/2024
4.0.180 380 7/26/2024
4.0.179 319 7/24/2024
4.0.178 354 7/11/2024
4.0.177 283 7/10/2024
4.0.176 193 7/10/2024
4.0.175 323 7/9/2024
4.0.174 450 7/5/2024
4.0.173 340 7/2/2024
4.0.172 409 6/27/2024
4.0.171 295 6/26/2024
4.0.170 381 6/24/2024
4.0.169 1,473 6/19/2024
4.0.168 289 6/18/2024
4.0.167 315 6/17/2024
4.0.166 323 6/14/2024
4.0.165 286 6/13/2024
4.0.164 428 6/3/2024
4.0.163 295 5/31/2024
4.0.162 294 5/30/2024
4.0.161 298 5/29/2024
4.0.160 513 5/27/2024
4.0.159 372 5/23/2024
4.0.158 379 5/21/2024
4.0.157 348 5/17/2024
4.0.156 275 5/16/2024
4.0.155 292 5/15/2024
4.0.154 337 5/8/2024
4.0.153 297 5/7/2024
4.0.152 299 5/6/2024
4.0.151 289 5/3/2024
4.0.150 1,013 5/2/2024
4.0.149 303 5/1/2024
4.0.148 304 4/30/2024
4.0.147 351 4/29/2024
4.0.146 325 4/25/2024
4.0.145 409 4/16/2024
4.0.144 331 4/12/2024
4.0.143 276 4/12/2024
4.0.142 296 4/11/2024
4.0.141 324 4/10/2024
4.0.140 289 4/9/2024
4.0.139 396 4/1/2024
4.0.138 338 3/29/2024
4.0.137 351 3/26/2024
4.0.136 324 3/22/2024
4.0.135 214 3/22/2024
4.0.134 386 3/18/2024
4.0.133 304 3/15/2024
4.0.132 287 3/14/2024
4.0.131 322 3/13/2024
4.0.130 321 3/11/2024
4.0.129 291 3/8/2024
4.0.128 258 3/7/2024
4.0.127 230 3/6/2024
4.0.126 229 3/5/2024
4.0.125 243 3/4/2024
4.0.124 1,756 3/1/2024
4.0.123 321 2/29/2024
4.0.122 203 2/28/2024
4.0.121 242 2/27/2024
4.0.120 457 2/26/2024
4.0.119 195 2/23/2024
4.0.118 224 2/22/2024
4.0.117 221 2/21/2024
4.0.116 227 2/20/2024
4.0.115 211 2/20/2024
4.0.114 1,070 2/19/2024
4.0.113 218 2/19/2024
4.0.112 343 2/16/2024
4.0.111 206 2/15/2024
4.0.110 242 2/14/2024
4.0.109 476 2/13/2024
4.0.108 306 2/12/2024
4.0.107 232 2/9/2024
4.0.106 363 2/8/2024
4.0.105 199 2/7/2024
4.0.104 197 2/7/2024
4.0.103 195 2/6/2024
4.0.102 1,026 2/2/2024
4.0.101 269 2/1/2024
4.0.100 204 2/1/2024
4.0.99 206 1/31/2024
4.0.98 202 1/30/2024
4.0.97 699 1/25/2024
4.0.96 278 1/24/2024
4.0.95 215 1/23/2024
4.0.94 1,730 1/16/2024
4.0.93 199 1/16/2024
4.0.92 314 1/15/2024
4.0.91 330 1/12/2024
4.0.90 199 1/11/2024
4.0.89 201 1/10/2024
4.0.88 711 1/8/2024
4.0.87 808 12/26/2023
4.0.86 200 12/26/2023
4.0.85 203 12/25/2023
4.0.84 545 12/22/2023
4.0.83 442 12/15/2023
4.0.82 213 12/14/2023
4.0.81 200 12/14/2023
4.0.80 229 12/13/2023
4.0.79 204 12/12/2023
4.0.78 1,185 12/11/2023
4.0.77 371 12/6/2023
4.0.76 365 12/5/2023
4.0.75 566 11/24/2023
4.0.74 405 11/21/2023
4.0.73 359 11/20/2023
4.0.72 254 11/20/2023
4.0.71 323 11/17/2023
4.0.70 784 11/16/2023
4.0.69 280 11/14/2023
4.0.68 411 11/9/2023
4.0.67 348 11/8/2023
4.0.66 288 11/7/2023
4.0.65 271 11/6/2023
4.0.64 308 11/3/2023
4.0.63 425 11/1/2023
4.0.62 188 11/1/2023
4.0.61 351 10/31/2023
4.0.60 328 10/30/2023
4.0.59 295 10/27/2023
4.0.58 305 10/26/2023
4.0.57 286 10/25/2023
4.0.56 289 10/17/2023
4.0.55 387 10/16/2023
4.0.54 411 10/12/2023
4.0.53 294 10/11/2023
4.0.52 340 10/5/2023
4.0.51 384 9/26/2023
4.0.50 413 9/22/2023
4.0.49 306 9/20/2023
4.0.48 284 9/19/2023
4.0.47 178 9/19/2023
4.0.46 360 9/18/2023
4.0.45 408 9/14/2023
4.0.44 312 9/13/2023
4.0.43 309 9/12/2023
4.0.42 343 9/11/2023
4.0.41 212 9/11/2023
4.0.40 294 9/11/2023
4.0.39 535 9/7/2023
4.0.38 320 9/6/2023
4.0.37 377 9/5/2023
4.0.36 216 9/5/2023
4.0.35 351 9/4/2023
4.0.34 405 9/1/2023
4.0.33 373 8/31/2023
4.0.32 349 8/30/2023
4.0.31 207 8/30/2023
4.0.30 376 8/29/2023
4.0.29 552 8/25/2023
4.0.28 478 8/23/2023
4.0.27 476 8/18/2023
4.0.26 328 8/17/2023
4.0.25 208 8/17/2023
4.0.24 212 8/17/2023
4.0.23 646 8/10/2023
4.0.22 352 8/9/2023
4.0.21 321 8/8/2023
4.0.20 238 8/8/2023
4.0.19 413 8/8/2023
4.0.18 499 8/7/2023
4.0.17 603 8/3/2023
4.0.16 533 7/26/2023
4.0.15 488 7/20/2023
4.0.14 513 7/18/2023
4.0.13 246 7/18/2023
4.0.12 239 7/18/2023
4.0.11 828 7/17/2023
4.0.10 251 7/14/2023
4.0.9 250 7/13/2023
4.0.8 233 7/13/2023
4.0.7 258 7/12/2023
4.0.6 255 7/12/2023
4.0.5 316 6/13/2023
4.0.4 1,623 1/30/2023
4.0.3 662 1/30/2023
4.0.2 665 1/27/2023
4.0.1 838 12/13/2022
4.0.0 646 12/12/2022
3.1.49 2,900 6/10/2022
3.1.47 1,981 4/20/2022
3.1.46 920 2/25/2022
3.1.45 2,188 1/11/2022
3.1.44 1,253 1/10/2022
3.1.43 1,268 10/12/2021
3.1.42 565 10/12/2021
3.1.41 1,897 6/17/2021
3.1.40 1,466 6/16/2021
3.1.39 1,323 6/16/2021
3.1.38 1,162 6/16/2021
3.1.37 872 6/15/2021
3.1.35 2,114 1/7/2021
3.1.34 1,570 12/16/2020
3.1.33 719 12/16/2020
3.1.32 1,382 12/14/2020
3.1.31 3,517 9/13/2020
3.1.30 1,909 6/19/2020
3.1.29 1,323 6/8/2020
3.1.28 2,690 5/12/2020
3.1.27 2,154 5/12/2020
3.1.26 1,671 4/28/2020
3.1.25 1,604 4/16/2020
3.1.23 1,524 4/16/2020
3.1.22 1,587 4/16/2020
3.1.21 1,303 4/15/2020
3.1.20 1,545 4/15/2020
3.1.19 1,607 4/14/2020
3.1.18 1,298 4/14/2020
3.1.17 772 4/14/2020
3.1.16 1,623 4/10/2020
3.1.15 1,629 4/10/2020
3.1.14 4,141 3/26/2020
3.1.13 1,657 3/26/2020
3.1.12 1,847 3/25/2020
3.1.11 1,310 3/25/2020
3.1.10 1,298 3/25/2020
3.1.9 1,781 3/25/2020
3.1.8 1,836 3/24/2020
3.1.7 2,505 3/21/2020
3.1.6 2,354 3/13/2020
3.1.5 1,343 3/13/2020
3.1.3 2,338 2/28/2020
3.1.1.2 767 2/28/2020
3.1.1 1,094 2/22/2020
3.1.0 1,359 2/21/2020
3.0.4 1,417 2/11/2020
3.0.3 1,084 2/11/2020
3.0.2 845 2/10/2020
3.0.1 1,823 1/9/2020
3.0.0 1,559 12/23/2019
2.0.18 2,856 6/19/2019
2.0.17 860 6/19/2019
2.0.16 2,368 4/17/2019
2.0.15 1,753 3/14/2019
2.0.14 923 2/22/2019
2.0.13 1,964 2/21/2019
2.0.12 900 2/21/2019
2.0.11 4,929 8/1/2018
2.0.10 1,999 8/1/2018
2.0.9 1,764 7/3/2018
2.0.8 2,302 6/26/2018
2.0.7 1,489 6/26/2018
2.0.6 2,084 6/14/2018
2.0.5 2,212 6/1/2018
2.0.4 2,506 5/22/2018
2.0.3 3,106 5/9/2018
2.0.2 2,731 2/15/2018
2.0.1 2,392 2/13/2018
2.0.0 3,185 1/2/2018
1.0.44 11,883 10/10/2017
1.0.42 1,269 10/10/2017
1.0.41 1,578 9/29/2017
1.0.40 4,699 9/19/2017
1.0.39 1,290 9/15/2017
1.0.36 1,270 9/15/2017
1.0.35 1,267 9/15/2017
1.0.34 3,683 7/3/2017
1.0.33 2,193 6/16/2017
1.0.32 2,186 6/16/2017
1.0.31 1,326 5/30/2017
1.0.28 2,061 5/30/2017
1.0.27 1,835 5/25/2017
1.0.26 2,098 5/24/2017
1.0.25 1,657 5/19/2017
1.0.24 1,343 5/19/2017
1.0.23 1,631 5/17/2017
1.0.20 1,440 5/8/2017
1.0.19 1,449 4/7/2017
1.0.18 2,074 3/22/2017
1.0.15 1,794 1/31/2017
1.0.14 1,448 1/24/2017
1.0.13 1,490 1/8/2017
1.0.12 1,454 1/6/2017
1.0.11 1,468 1/6/2017
1.0.10 1,426 1/3/2017
1.0.9 1,552 12/9/2016
1.0.8 1,382 12/1/2016
1.0.0 1,353 9/15/2017