SQLHelper.DB 5.0.50

There is a newer version of this package available.
See the version list below for details.
dotnet add package SQLHelper.DB --version 5.0.50
                    
NuGet\Install-Package SQLHelper.DB -Version 5.0.50
                    
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="5.0.50" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLHelper.DB" Version="5.0.50" />
                    
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 5.0.50
                    
#r "nuget: SQLHelper.DB, 5.0.50"
                    
#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@5.0.50
                    
#: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=5.0.50
                    
Install as a Cake Addin
#tool nuget:?package=SQLHelper.DB&version=5.0.50
                    
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 net8.0 is compatible.  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.51 0 7/17/2025
5.0.50 173 7/14/2025
5.0.46 476 6/30/2025
5.0.45 141 6/30/2025
5.0.44 336 6/27/2025
5.0.43 210 6/27/2025
5.0.42 216 6/26/2025
5.0.41 210 6/18/2025
5.0.39 324 6/10/2025
5.0.38 223 5/30/2025
5.0.37 211 5/23/2025
5.0.36 300 5/14/2025
5.0.34 192 5/2/2025
5.0.33 225 4/28/2025
5.0.32 309 4/10/2025
5.0.30 257 3/15/2025
5.0.28 280 2/24/2025
5.0.27 625 2/12/2025
5.0.25 367 2/3/2025
5.0.24 272 1/30/2025
5.0.23 193 1/29/2025
5.0.22 240 1/24/2025
5.0.21 222 1/22/2025
5.0.20 225 1/16/2025
5.0.19 139 1/15/2025
5.0.15 181 1/13/2025
5.0.14 190 1/9/2025
5.0.13 402 12/17/2024
5.0.12 265 12/10/2024
5.0.11 125 12/10/2024
5.0.10 123 12/10/2024
5.0.9 174 12/9/2024
5.0.8 337 11/26/2024
5.0.7 117 11/26/2024
5.0.6 260 11/24/2024
5.0.5 127 11/24/2024
5.0.4 153 11/23/2024
4.0.218 223 11/20/2024
4.0.217 156 11/12/2024
4.0.216 291 11/11/2024
4.0.215 183 11/6/2024
4.0.214 251 11/5/2024
4.0.213 181 11/4/2024
4.0.212 198 11/1/2024
4.0.211 179 10/31/2024
4.0.210 178 10/30/2024
4.0.209 171 10/29/2024
4.0.208 229 10/25/2024
4.0.207 246 10/21/2024
4.0.206 220 10/16/2024
4.0.205 233 10/11/2024
4.0.204 184 10/10/2024
4.0.203 181 10/9/2024
4.0.202 259 10/2/2024
4.0.201 190 10/1/2024
4.0.200 218 9/30/2024
4.0.199 246 9/24/2024
4.0.198 213 9/23/2024
4.0.197 261 9/17/2024
4.0.196 270 9/10/2024
4.0.195 263 9/6/2024
4.0.194 278 9/3/2024
4.0.193 268 8/30/2024
4.0.192 203 8/29/2024
4.0.191 199 8/28/2024
4.0.190 208 8/27/2024
4.0.189 223 8/26/2024
4.0.188 225 8/23/2024
4.0.187 290 8/21/2024
4.0.186 402 8/16/2024
4.0.185 211 8/15/2024
4.0.184 220 8/14/2024
4.0.183 221 8/5/2024
4.0.182 178 8/2/2024
4.0.181 199 8/1/2024
4.0.180 268 7/26/2024
4.0.179 211 7/24/2024
4.0.178 271 7/11/2024
4.0.177 205 7/10/2024
4.0.176 139 7/10/2024
4.0.175 225 7/9/2024
4.0.174 329 7/5/2024
4.0.173 258 7/2/2024
4.0.172 302 6/27/2024
4.0.171 207 6/26/2024
4.0.170 279 6/24/2024
4.0.169 1,132 6/19/2024
4.0.168 218 6/18/2024
4.0.167 221 6/17/2024
4.0.166 235 6/14/2024
4.0.165 203 6/13/2024
4.0.164 325 6/3/2024
4.0.163 226 5/31/2024
4.0.162 221 5/30/2024
4.0.161 214 5/29/2024
4.0.160 402 5/27/2024
4.0.159 272 5/23/2024
4.0.158 274 5/21/2024
4.0.157 251 5/17/2024
4.0.156 208 5/16/2024
4.0.155 212 5/15/2024
4.0.154 261 5/8/2024
4.0.153 223 5/7/2024
4.0.152 235 5/6/2024
4.0.151 218 5/3/2024
4.0.150 750 5/2/2024
4.0.149 237 5/1/2024
4.0.148 225 4/30/2024
4.0.147 263 4/29/2024
4.0.146 247 4/25/2024
4.0.145 309 4/16/2024
4.0.144 232 4/12/2024
4.0.143 199 4/12/2024
4.0.142 221 4/11/2024
4.0.141 243 4/10/2024
4.0.140 219 4/9/2024
4.0.139 294 4/1/2024
4.0.138 262 3/29/2024
4.0.137 257 3/26/2024
4.0.136 241 3/22/2024
4.0.135 148 3/22/2024
4.0.134 284 3/18/2024
4.0.133 229 3/15/2024
4.0.132 211 3/14/2024
4.0.131 245 3/13/2024
4.0.130 244 3/11/2024
4.0.129 220 3/8/2024
4.0.128 193 3/7/2024
4.0.127 168 3/6/2024
4.0.126 179 3/5/2024
4.0.125 177 3/4/2024
4.0.124 1,293 3/1/2024
4.0.123 233 2/29/2024
4.0.122 143 2/28/2024
4.0.121 184 2/27/2024
4.0.120 337 2/26/2024
4.0.119 146 2/23/2024
4.0.118 172 2/22/2024
4.0.117 151 2/21/2024
4.0.116 171 2/20/2024
4.0.115 149 2/20/2024
4.0.114 769 2/19/2024
4.0.113 162 2/19/2024
4.0.112 242 2/16/2024
4.0.111 149 2/15/2024
4.0.110 175 2/14/2024
4.0.109 355 2/13/2024
4.0.108 229 2/12/2024
4.0.107 171 2/9/2024
4.0.106 262 2/8/2024
4.0.105 143 2/7/2024
4.0.104 133 2/7/2024
4.0.103 140 2/6/2024
4.0.102 719 2/2/2024
4.0.101 197 2/1/2024
4.0.100 146 2/1/2024
4.0.99 149 1/31/2024
4.0.98 146 1/30/2024
4.0.97 485 1/25/2024
4.0.96 196 1/24/2024
4.0.95 158 1/23/2024
4.0.94 1,228 1/16/2024
4.0.93 144 1/16/2024
4.0.92 231 1/15/2024
4.0.91 238 1/12/2024
4.0.90 152 1/11/2024
4.0.89 155 1/10/2024
4.0.88 516 1/8/2024
4.0.87 622 12/26/2023
4.0.86 143 12/26/2023
4.0.85 150 12/25/2023
4.0.84 391 12/22/2023
4.0.83 332 12/15/2023
4.0.82 147 12/14/2023
4.0.81 133 12/14/2023
4.0.80 174 12/13/2023
4.0.79 149 12/12/2023
4.0.78 851 12/11/2023
4.0.77 314 12/6/2023
4.0.76 272 12/5/2023
4.0.75 429 11/24/2023
4.0.74 295 11/21/2023
4.0.73 262 11/20/2023
4.0.72 213 11/20/2023
4.0.71 237 11/17/2023
4.0.70 725 11/16/2023
4.0.69 221 11/14/2023
4.0.68 306 11/9/2023
4.0.67 258 11/8/2023
4.0.66 224 11/7/2023
4.0.65 222 11/6/2023
4.0.64 231 11/3/2023
4.0.63 315 11/1/2023
4.0.62 151 11/1/2023
4.0.61 257 10/31/2023
4.0.60 238 10/30/2023
4.0.59 236 10/27/2023
4.0.58 221 10/26/2023
4.0.57 230 10/25/2023
4.0.56 231 10/17/2023
4.0.55 286 10/16/2023
4.0.54 311 10/12/2023
4.0.53 224 10/11/2023
4.0.52 277 10/5/2023
4.0.51 317 9/26/2023
4.0.50 311 9/22/2023
4.0.49 234 9/20/2023
4.0.48 216 9/19/2023
4.0.47 142 9/19/2023
4.0.46 277 9/18/2023
4.0.45 317 9/14/2023
4.0.44 233 9/13/2023
4.0.43 237 9/12/2023
4.0.42 277 9/11/2023
4.0.41 166 9/11/2023
4.0.40 233 9/11/2023
4.0.39 402 9/7/2023
4.0.38 240 9/6/2023
4.0.37 295 9/5/2023
4.0.36 182 9/5/2023
4.0.35 273 9/4/2023
4.0.34 316 9/1/2023
4.0.33 300 8/31/2023
4.0.32 265 8/30/2023
4.0.31 170 8/30/2023
4.0.30 295 8/29/2023
4.0.29 425 8/25/2023
4.0.28 358 8/23/2023
4.0.27 365 8/18/2023
4.0.26 251 8/17/2023
4.0.25 161 8/17/2023
4.0.24 166 8/17/2023
4.0.23 479 8/10/2023
4.0.22 276 8/9/2023
4.0.21 251 8/8/2023
4.0.20 189 8/8/2023
4.0.19 328 8/8/2023
4.0.18 394 8/7/2023
4.0.17 485 8/3/2023
4.0.16 418 7/26/2023
4.0.15 385 7/20/2023
4.0.14 392 7/18/2023
4.0.13 195 7/18/2023
4.0.12 182 7/18/2023
4.0.11 622 7/17/2023
4.0.10 196 7/14/2023
4.0.9 198 7/13/2023
4.0.8 187 7/13/2023
4.0.7 203 7/12/2023
4.0.6 198 7/12/2023
4.0.5 253 6/13/2023
4.0.4 1,274 1/30/2023
4.0.3 564 1/30/2023
4.0.2 567 1/27/2023
4.0.1 736 12/13/2022
4.0.0 551 12/12/2022
3.1.49 2,729 6/10/2022
3.1.47 1,863 4/20/2022
3.1.46 851 2/25/2022
3.1.45 2,061 1/11/2022
3.1.44 1,130 1/10/2022
3.1.43 1,185 10/12/2021
3.1.42 506 10/12/2021
3.1.41 1,771 6/17/2021
3.1.40 1,323 6/16/2021
3.1.39 1,207 6/16/2021
3.1.38 1,023 6/16/2021
3.1.37 789 6/15/2021
3.1.35 1,974 1/7/2021
3.1.34 1,440 12/16/2020
3.1.33 635 12/16/2020
3.1.32 1,243 12/14/2020
3.1.31 3,277 9/13/2020
3.1.30 1,762 6/19/2020
3.1.29 1,215 6/8/2020
3.1.28 2,513 5/12/2020
3.1.27 1,991 5/12/2020
3.1.26 1,509 4/28/2020
3.1.25 1,461 4/16/2020
3.1.23 1,412 4/16/2020
3.1.22 1,453 4/16/2020
3.1.21 1,194 4/15/2020
3.1.20 1,418 4/15/2020
3.1.19 1,494 4/14/2020
3.1.18 1,193 4/14/2020
3.1.17 682 4/14/2020
3.1.16 1,493 4/10/2020
3.1.15 1,510 4/10/2020
3.1.14 3,943 3/26/2020
3.1.13 1,528 3/26/2020
3.1.12 1,714 3/25/2020
3.1.11 1,202 3/25/2020
3.1.10 1,188 3/25/2020
3.1.9 1,632 3/25/2020
3.1.8 1,708 3/24/2020
3.1.7 2,328 3/21/2020
3.1.6 2,224 3/13/2020
3.1.5 1,220 3/13/2020
3.1.3 2,185 2/28/2020
3.1.1.2 683 2/28/2020
3.1.1 1,002 2/22/2020
3.1.0 1,245 2/21/2020
3.0.4 1,303 2/11/2020
3.0.3 966 2/11/2020
3.0.2 752 2/10/2020
3.0.1 1,709 1/9/2020
3.0.0 1,455 12/23/2019
2.0.18 2,698 6/19/2019
2.0.17 766 6/19/2019
2.0.16 2,188 4/17/2019
2.0.15 1,618 3/14/2019
2.0.14 829 2/22/2019
2.0.13 1,823 2/21/2019
2.0.12 805 2/21/2019
2.0.11 4,639 8/1/2018
2.0.10 1,816 8/1/2018
2.0.9 1,571 7/3/2018
2.0.8 2,043 6/26/2018
2.0.7 1,296 6/26/2018
2.0.6 1,840 6/14/2018
2.0.5 1,933 6/1/2018
2.0.4 2,225 5/22/2018
2.0.3 2,841 5/9/2018
2.0.2 2,509 2/15/2018
2.0.1 2,154 2/13/2018
2.0.0 2,873 1/2/2018
1.0.44 11,395 10/10/2017
1.0.42 1,116 10/10/2017
1.0.41 1,425 9/29/2017
1.0.40 4,408 9/19/2017
1.0.39 1,140 9/15/2017
1.0.36 1,127 9/15/2017
1.0.35 1,111 9/15/2017
1.0.34 3,387 7/3/2017
1.0.33 1,987 6/16/2017
1.0.32 1,944 6/16/2017
1.0.31 1,179 5/30/2017
1.0.28 1,832 5/30/2017
1.0.27 1,635 5/25/2017
1.0.26 1,902 5/24/2017
1.0.25 1,487 5/19/2017
1.0.24 1,174 5/19/2017
1.0.23 1,468 5/17/2017
1.0.20 1,272 5/8/2017
1.0.19 1,318 4/7/2017
1.0.18 1,878 3/22/2017
1.0.15 1,613 1/31/2017
1.0.14 1,303 1/24/2017
1.0.13 1,317 1/8/2017
1.0.12 1,284 1/6/2017
1.0.11 1,304 1/6/2017
1.0.10 1,271 1/3/2017
1.0.9 1,396 12/9/2016
1.0.8 1,222 12/1/2016
1.0.0 1,207 9/15/2017