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.71 149 9/11/2025
5.0.70 155 9/10/2025
5.0.69 122 9/10/2025
5.0.68 121 9/10/2025
5.0.67 524 8/19/2025
5.0.66 141 8/19/2025
5.0.65 142 8/19/2025
5.0.64 145 8/19/2025
5.0.63 141 8/19/2025
5.0.62 225 8/18/2025
5.0.61 241 8/15/2025
5.0.60 371 8/6/2025
5.0.59 309 8/5/2025
5.0.58 234 8/5/2025
5.0.57 229 8/5/2025
5.0.56 218 8/5/2025
5.0.55 214 8/5/2025
5.0.54 286 8/4/2025
5.0.53 137 8/4/2025
5.0.52 213 7/28/2025
5.0.51 258 7/17/2025
5.0.50 331 7/14/2025
5.0.46 499 6/30/2025
5.0.45 161 6/30/2025
5.0.44 357 6/27/2025
5.0.43 228 6/27/2025
5.0.42 236 6/26/2025
5.0.41 237 6/18/2025
5.0.39 350 6/10/2025
5.0.38 245 5/30/2025
5.0.37 226 5/23/2025
5.0.36 317 5/14/2025
5.0.34 211 5/2/2025
5.0.33 246 4/28/2025
5.0.32 325 4/10/2025
5.0.30 275 3/15/2025
5.0.28 295 2/24/2025
5.0.27 641 2/12/2025
5.0.25 387 2/3/2025
5.0.24 293 1/30/2025
5.0.23 208 1/29/2025
5.0.22 255 1/24/2025
5.0.21 236 1/22/2025
5.0.20 244 1/16/2025
5.0.19 155 1/15/2025
5.0.15 197 1/13/2025
5.0.14 206 1/9/2025
5.0.13 419 12/17/2024
5.0.12 279 12/10/2024
5.0.11 143 12/10/2024
5.0.10 139 12/10/2024
5.0.9 192 12/9/2024
5.0.8 352 11/26/2024
5.0.7 133 11/26/2024
5.0.6 274 11/24/2024
5.0.5 143 11/24/2024
5.0.4 169 11/23/2024
4.0.218 243 11/20/2024
4.0.217 172 11/12/2024
4.0.216 308 11/11/2024
4.0.215 197 11/6/2024
4.0.214 267 11/5/2024
4.0.213 196 11/4/2024
4.0.212 214 11/1/2024
4.0.211 192 10/31/2024
4.0.210 194 10/30/2024
4.0.209 187 10/29/2024
4.0.208 243 10/25/2024
4.0.207 262 10/21/2024
4.0.206 238 10/16/2024
4.0.205 250 10/11/2024
4.0.204 199 10/10/2024
4.0.203 198 10/9/2024
4.0.202 274 10/2/2024
4.0.201 208 10/1/2024
4.0.200 236 9/30/2024
4.0.199 262 9/24/2024
4.0.198 229 9/23/2024
4.0.197 277 9/17/2024
4.0.196 284 9/10/2024
4.0.195 277 9/6/2024
4.0.194 294 9/3/2024
4.0.193 281 8/30/2024
4.0.192 218 8/29/2024
4.0.191 216 8/28/2024
4.0.190 224 8/27/2024
4.0.189 237 8/26/2024
4.0.188 240 8/23/2024
4.0.187 308 8/21/2024
4.0.186 416 8/16/2024
4.0.185 225 8/15/2024
4.0.184 237 8/14/2024
4.0.183 235 8/5/2024
4.0.182 194 8/2/2024
4.0.181 212 8/1/2024
4.0.180 283 7/26/2024
4.0.179 227 7/24/2024
4.0.178 286 7/11/2024
4.0.177 218 7/10/2024
4.0.176 153 7/10/2024
4.0.175 242 7/9/2024
4.0.174 344 7/5/2024
4.0.173 271 7/2/2024
4.0.172 317 6/27/2024
4.0.171 223 6/26/2024
4.0.170 291 6/24/2024
4.0.169 1,147 6/19/2024
4.0.168 234 6/18/2024
4.0.167 237 6/17/2024
4.0.166 250 6/14/2024
4.0.165 219 6/13/2024
4.0.164 340 6/3/2024
4.0.163 239 5/31/2024
4.0.162 234 5/30/2024
4.0.161 228 5/29/2024
4.0.160 435 5/27/2024
4.0.159 287 5/23/2024
4.0.158 288 5/21/2024
4.0.157 266 5/17/2024
4.0.156 224 5/16/2024
4.0.155 228 5/15/2024
4.0.154 277 5/8/2024
4.0.153 239 5/7/2024
4.0.152 250 5/6/2024
4.0.151 233 5/3/2024
4.0.150 768 5/2/2024
4.0.149 252 5/1/2024
4.0.148 240 4/30/2024
4.0.147 279 4/29/2024
4.0.146 261 4/25/2024
4.0.145 324 4/16/2024
4.0.144 247 4/12/2024
4.0.143 212 4/12/2024
4.0.142 235 4/11/2024
4.0.141 258 4/10/2024
4.0.140 234 4/9/2024
4.0.139 309 4/1/2024
4.0.138 278 3/29/2024
4.0.137 272 3/26/2024
4.0.136 257 3/22/2024
4.0.135 162 3/22/2024
4.0.134 297 3/18/2024
4.0.133 241 3/15/2024
4.0.132 223 3/14/2024
4.0.131 260 3/13/2024
4.0.130 260 3/11/2024
4.0.129 234 3/8/2024
4.0.128 210 3/7/2024
4.0.127 182 3/6/2024
4.0.126 196 3/5/2024
4.0.125 196 3/4/2024
4.0.124 1,307 3/1/2024
4.0.123 248 2/29/2024
4.0.122 159 2/28/2024
4.0.121 199 2/27/2024
4.0.120 351 2/26/2024
4.0.119 163 2/23/2024
4.0.118 186 2/22/2024
4.0.117 169 2/21/2024
4.0.116 184 2/20/2024
4.0.115 164 2/20/2024
4.0.114 783 2/19/2024
4.0.113 178 2/19/2024
4.0.112 258 2/16/2024
4.0.111 164 2/15/2024
4.0.110 190 2/14/2024
4.0.109 371 2/13/2024
4.0.108 244 2/12/2024
4.0.107 184 2/9/2024
4.0.106 275 2/8/2024
4.0.105 157 2/7/2024
4.0.104 146 2/7/2024
4.0.103 154 2/6/2024
4.0.102 733 2/2/2024
4.0.101 210 2/1/2024
4.0.100 161 2/1/2024
4.0.99 165 1/31/2024
4.0.98 160 1/30/2024
4.0.97 499 1/25/2024
4.0.96 210 1/24/2024
4.0.95 171 1/23/2024
4.0.94 1,239 1/16/2024
4.0.93 158 1/16/2024
4.0.92 246 1/15/2024
4.0.91 252 1/12/2024
4.0.90 166 1/11/2024
4.0.89 167 1/10/2024
4.0.88 531 1/8/2024
4.0.87 640 12/26/2023
4.0.86 157 12/26/2023
4.0.85 163 12/25/2023
4.0.84 404 12/22/2023
4.0.83 346 12/15/2023
4.0.82 163 12/14/2023
4.0.81 148 12/14/2023
4.0.80 185 12/13/2023
4.0.79 162 12/12/2023
4.0.78 864 12/11/2023
4.0.77 321 12/6/2023
4.0.76 278 12/5/2023
4.0.75 435 11/24/2023
4.0.74 303 11/21/2023
4.0.73 269 11/20/2023
4.0.72 220 11/20/2023
4.0.71 246 11/17/2023
4.0.70 732 11/16/2023
4.0.69 228 11/14/2023
4.0.68 313 11/9/2023
4.0.67 265 11/8/2023
4.0.66 231 11/7/2023
4.0.65 228 11/6/2023
4.0.64 242 11/3/2023
4.0.63 322 11/1/2023
4.0.62 157 11/1/2023
4.0.61 265 10/31/2023
4.0.60 245 10/30/2023
4.0.59 242 10/27/2023
4.0.58 232 10/26/2023
4.0.57 237 10/25/2023
4.0.56 240 10/17/2023
4.0.55 295 10/16/2023
4.0.54 321 10/12/2023
4.0.53 232 10/11/2023
4.0.52 287 10/5/2023
4.0.51 327 9/26/2023
4.0.50 321 9/22/2023
4.0.49 241 9/20/2023
4.0.48 226 9/19/2023
4.0.47 149 9/19/2023
4.0.46 287 9/18/2023
4.0.45 325 9/14/2023
4.0.44 240 9/13/2023
4.0.43 249 9/12/2023
4.0.42 291 9/11/2023
4.0.41 180 9/11/2023
4.0.40 246 9/11/2023
4.0.39 423 9/7/2023
4.0.38 260 9/6/2023
4.0.37 310 9/5/2023
4.0.36 196 9/5/2023
4.0.35 286 9/4/2023
4.0.34 331 9/1/2023
4.0.33 316 8/31/2023
4.0.32 281 8/30/2023
4.0.31 185 8/30/2023
4.0.30 312 8/29/2023
4.0.29 440 8/25/2023
4.0.28 374 8/23/2023
4.0.27 381 8/18/2023
4.0.26 267 8/17/2023
4.0.25 176 8/17/2023
4.0.24 180 8/17/2023
4.0.23 497 8/10/2023
4.0.22 294 8/9/2023
4.0.21 270 8/8/2023
4.0.20 206 8/8/2023
4.0.19 346 8/8/2023
4.0.18 412 8/7/2023
4.0.17 501 8/3/2023
4.0.16 435 7/26/2023
4.0.15 404 7/20/2023
4.0.14 411 7/18/2023
4.0.13 214 7/18/2023
4.0.12 201 7/18/2023
4.0.11 641 7/17/2023
4.0.10 216 7/14/2023
4.0.9 216 7/13/2023
4.0.8 206 7/13/2023
4.0.7 223 7/12/2023
4.0.6 217 7/12/2023
4.0.5 273 6/13/2023
4.0.4 1,371 1/30/2023
4.0.3 585 1/30/2023
4.0.2 590 1/27/2023
4.0.1 758 12/13/2022
4.0.0 576 12/12/2022
3.1.49 2,760 6/10/2022
3.1.47 1,888 4/20/2022
3.1.46 875 2/25/2022
3.1.45 2,086 1/11/2022
3.1.44 1,153 1/10/2022
3.1.43 1,207 10/12/2021
3.1.42 528 10/12/2021
3.1.41 1,796 6/17/2021
3.1.40 1,348 6/16/2021
3.1.39 1,230 6/16/2021
3.1.38 1,048 6/16/2021
3.1.37 813 6/15/2021
3.1.35 2,001 1/7/2021
3.1.34 1,466 12/16/2020
3.1.33 666 12/16/2020
3.1.32 1,268 12/14/2020
3.1.31 3,305 9/13/2020
3.1.30 1,791 6/19/2020
3.1.29 1,241 6/8/2020
3.1.28 2,541 5/12/2020
3.1.27 2,017 5/12/2020
3.1.26 1,537 4/28/2020
3.1.25 1,488 4/16/2020
3.1.23 1,437 4/16/2020
3.1.22 1,480 4/16/2020
3.1.21 1,220 4/15/2020
3.1.20 1,445 4/15/2020
3.1.19 1,521 4/14/2020
3.1.18 1,219 4/14/2020
3.1.17 707 4/14/2020
3.1.16 1,520 4/10/2020
3.1.15 1,537 4/10/2020
3.1.14 3,971 3/26/2020
3.1.13 1,555 3/26/2020
3.1.12 1,742 3/25/2020
3.1.11 1,229 3/25/2020
3.1.10 1,214 3/25/2020
3.1.9 1,659 3/25/2020
3.1.8 1,735 3/24/2020
3.1.7 2,355 3/21/2020
3.1.6 2,250 3/13/2020
3.1.5 1,246 3/13/2020
3.1.3 2,211 2/28/2020
3.1.1.2 709 2/28/2020
3.1.1 1,030 2/22/2020
3.1.0 1,272 2/21/2020
3.0.4 1,330 2/11/2020
3.0.3 993 2/11/2020
3.0.2 779 2/10/2020
3.0.1 1,737 1/9/2020
3.0.0 1,485 12/23/2019
2.0.18 2,741 6/19/2019
2.0.17 794 6/19/2019
2.0.16 2,216 4/17/2019
2.0.15 1,645 3/14/2019
2.0.14 856 2/22/2019
2.0.13 1,850 2/21/2019
2.0.12 830 2/21/2019
2.0.11 4,689 8/1/2018
2.0.10 1,865 8/1/2018
2.0.9 1,642 7/3/2018
2.0.8 2,118 6/26/2018
2.0.7 1,368 6/26/2018
2.0.6 1,915 6/14/2018
2.0.5 2,009 6/1/2018
2.0.4 2,300 5/22/2018
2.0.3 2,919 5/9/2018
2.0.2 2,589 2/15/2018
2.0.1 2,230 2/13/2018
2.0.0 2,952 1/2/2018
1.0.44 11,447 10/10/2017
1.0.42 1,168 10/10/2017
1.0.41 1,476 9/29/2017
1.0.40 4,458 9/19/2017
1.0.39 1,189 9/15/2017
1.0.36 1,177 9/15/2017
1.0.35 1,162 9/15/2017
1.0.34 3,438 7/3/2017
1.0.33 2,038 6/16/2017
1.0.32 1,994 6/16/2017
1.0.31 1,231 5/30/2017
1.0.28 1,883 5/30/2017
1.0.27 1,686 5/25/2017
1.0.26 1,953 5/24/2017
1.0.25 1,538 5/19/2017
1.0.24 1,226 5/19/2017
1.0.23 1,520 5/17/2017
1.0.20 1,326 5/8/2017
1.0.19 1,369 4/7/2017
1.0.18 1,933 3/22/2017
1.0.15 1,666 1/31/2017
1.0.14 1,358 1/24/2017
1.0.13 1,370 1/8/2017
1.0.12 1,335 1/6/2017
1.0.11 1,355 1/6/2017
1.0.10 1,322 1/3/2017
1.0.9 1,449 12/9/2016
1.0.8 1,276 12/1/2016
1.0.0 1,259 9/15/2017