SQLHelper.DB 5.0.61

There is a newer version of this package available.
See the version list below for details.
dotnet add package SQLHelper.DB --version 5.0.61
                    
NuGet\Install-Package SQLHelper.DB -Version 5.0.61
                    
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.61" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLHelper.DB" Version="5.0.61" />
                    
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.61
                    
#r "nuget: SQLHelper.DB, 5.0.61"
                    
#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.61
                    
#: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.61
                    
Install as a Cake Addin
#tool nuget:?package=SQLHelper.DB&version=5.0.61
                    
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.67 10 8/19/2025
5.0.66 9 8/19/2025
5.0.65 11 8/19/2025
5.0.64 13 8/19/2025
5.0.63 10 8/19/2025
5.0.62 12 8/18/2025
5.0.61 91 8/15/2025
5.0.60 234 8/6/2025
5.0.59 280 8/5/2025
5.0.58 219 8/5/2025
5.0.57 215 8/5/2025
5.0.56 203 8/5/2025
5.0.55 198 8/5/2025
5.0.54 272 8/4/2025
5.0.53 125 8/4/2025
5.0.52 184 7/28/2025
5.0.51 153 7/17/2025
5.0.50 286 7/14/2025
5.0.46 482 6/30/2025
5.0.45 147 6/30/2025
5.0.44 343 6/27/2025
5.0.43 214 6/27/2025
5.0.42 222 6/26/2025
5.0.41 218 6/18/2025
5.0.39 333 6/10/2025
5.0.38 228 5/30/2025
5.0.37 215 5/23/2025
5.0.36 305 5/14/2025
5.0.34 196 5/2/2025
5.0.33 230 4/28/2025
5.0.32 312 4/10/2025
5.0.30 262 3/15/2025
5.0.28 283 2/24/2025
5.0.27 629 2/12/2025
5.0.25 370 2/3/2025
5.0.24 275 1/30/2025
5.0.23 197 1/29/2025
5.0.22 243 1/24/2025
5.0.21 226 1/22/2025
5.0.20 230 1/16/2025
5.0.19 142 1/15/2025
5.0.15 185 1/13/2025
5.0.14 194 1/9/2025
5.0.13 405 12/17/2024
5.0.12 268 12/10/2024
5.0.11 129 12/10/2024
5.0.10 126 12/10/2024
5.0.9 180 12/9/2024
5.0.8 341 11/26/2024
5.0.7 121 11/26/2024
5.0.6 263 11/24/2024
5.0.5 131 11/24/2024
5.0.4 157 11/23/2024
4.0.218 230 11/20/2024
4.0.217 160 11/12/2024
4.0.216 295 11/11/2024
4.0.215 186 11/6/2024
4.0.214 255 11/5/2024
4.0.213 184 11/4/2024
4.0.212 201 11/1/2024
4.0.211 182 10/31/2024
4.0.210 183 10/30/2024
4.0.209 175 10/29/2024
4.0.208 232 10/25/2024
4.0.207 249 10/21/2024
4.0.206 224 10/16/2024
4.0.205 238 10/11/2024
4.0.204 188 10/10/2024
4.0.203 185 10/9/2024
4.0.202 262 10/2/2024
4.0.201 196 10/1/2024
4.0.200 224 9/30/2024
4.0.199 251 9/24/2024
4.0.198 218 9/23/2024
4.0.197 265 9/17/2024
4.0.196 272 9/10/2024
4.0.195 266 9/6/2024
4.0.194 282 9/3/2024
4.0.193 270 8/30/2024
4.0.192 205 8/29/2024
4.0.191 202 8/28/2024
4.0.190 210 8/27/2024
4.0.189 225 8/26/2024
4.0.188 227 8/23/2024
4.0.187 294 8/21/2024
4.0.186 404 8/16/2024
4.0.185 214 8/15/2024
4.0.184 223 8/14/2024
4.0.183 224 8/5/2024
4.0.182 182 8/2/2024
4.0.181 201 8/1/2024
4.0.180 270 7/26/2024
4.0.179 215 7/24/2024
4.0.178 273 7/11/2024
4.0.177 207 7/10/2024
4.0.176 142 7/10/2024
4.0.175 229 7/9/2024
4.0.174 332 7/5/2024
4.0.173 260 7/2/2024
4.0.172 305 6/27/2024
4.0.171 211 6/26/2024
4.0.170 280 6/24/2024
4.0.169 1,134 6/19/2024
4.0.168 222 6/18/2024
4.0.167 225 6/17/2024
4.0.166 238 6/14/2024
4.0.165 206 6/13/2024
4.0.164 329 6/3/2024
4.0.163 229 5/31/2024
4.0.162 223 5/30/2024
4.0.161 217 5/29/2024
4.0.160 404 5/27/2024
4.0.159 276 5/23/2024
4.0.158 276 5/21/2024
4.0.157 254 5/17/2024
4.0.156 210 5/16/2024
4.0.155 215 5/15/2024
4.0.154 264 5/8/2024
4.0.153 227 5/7/2024
4.0.152 238 5/6/2024
4.0.151 222 5/3/2024
4.0.150 756 5/2/2024
4.0.149 240 5/1/2024
4.0.148 228 4/30/2024
4.0.147 267 4/29/2024
4.0.146 249 4/25/2024
4.0.145 311 4/16/2024
4.0.144 235 4/12/2024
4.0.143 201 4/12/2024
4.0.142 223 4/11/2024
4.0.141 246 4/10/2024
4.0.140 222 4/9/2024
4.0.139 297 4/1/2024
4.0.138 265 3/29/2024
4.0.137 260 3/26/2024
4.0.136 245 3/22/2024
4.0.135 150 3/22/2024
4.0.134 286 3/18/2024
4.0.133 230 3/15/2024
4.0.132 212 3/14/2024
4.0.131 247 3/13/2024
4.0.130 247 3/11/2024
4.0.129 222 3/8/2024
4.0.128 197 3/7/2024
4.0.127 170 3/6/2024
4.0.126 180 3/5/2024
4.0.125 181 3/4/2024
4.0.124 1,294 3/1/2024
4.0.123 235 2/29/2024
4.0.122 147 2/28/2024
4.0.121 187 2/27/2024
4.0.120 339 2/26/2024
4.0.119 148 2/23/2024
4.0.118 174 2/22/2024
4.0.117 155 2/21/2024
4.0.116 172 2/20/2024
4.0.115 151 2/20/2024
4.0.114 770 2/19/2024
4.0.113 164 2/19/2024
4.0.112 246 2/16/2024
4.0.111 151 2/15/2024
4.0.110 179 2/14/2024
4.0.109 359 2/13/2024
4.0.108 230 2/12/2024
4.0.107 172 2/9/2024
4.0.106 263 2/8/2024
4.0.105 145 2/7/2024
4.0.104 134 2/7/2024
4.0.103 141 2/6/2024
4.0.102 720 2/2/2024
4.0.101 198 2/1/2024
4.0.100 148 2/1/2024
4.0.99 152 1/31/2024
4.0.98 148 1/30/2024
4.0.97 486 1/25/2024
4.0.96 198 1/24/2024
4.0.95 159 1/23/2024
4.0.94 1,228 1/16/2024
4.0.93 144 1/16/2024
4.0.92 234 1/15/2024
4.0.91 241 1/12/2024
4.0.90 153 1/11/2024
4.0.89 156 1/10/2024
4.0.88 518 1/8/2024
4.0.87 624 12/26/2023
4.0.86 145 12/26/2023
4.0.85 152 12/25/2023
4.0.84 393 12/22/2023
4.0.83 333 12/15/2023
4.0.82 149 12/14/2023
4.0.81 137 12/14/2023
4.0.80 175 12/13/2023
4.0.79 151 12/12/2023
4.0.78 852 12/11/2023
4.0.77 317 12/6/2023
4.0.76 273 12/5/2023
4.0.75 432 11/24/2023
4.0.74 297 11/21/2023
4.0.73 265 11/20/2023
4.0.72 217 11/20/2023
4.0.71 241 11/17/2023
4.0.70 727 11/16/2023
4.0.69 225 11/14/2023
4.0.68 308 11/9/2023
4.0.67 260 11/8/2023
4.0.66 226 11/7/2023
4.0.65 225 11/6/2023
4.0.64 237 11/3/2023
4.0.63 318 11/1/2023
4.0.62 154 11/1/2023
4.0.61 260 10/31/2023
4.0.60 241 10/30/2023
4.0.59 239 10/27/2023
4.0.58 226 10/26/2023
4.0.57 233 10/25/2023
4.0.56 236 10/17/2023
4.0.55 291 10/16/2023
4.0.54 316 10/12/2023
4.0.53 228 10/11/2023
4.0.52 282 10/5/2023
4.0.51 322 9/26/2023
4.0.50 316 9/22/2023
4.0.49 238 9/20/2023
4.0.48 221 9/19/2023
4.0.47 146 9/19/2023
4.0.46 281 9/18/2023
4.0.45 322 9/14/2023
4.0.44 237 9/13/2023
4.0.43 243 9/12/2023
4.0.42 284 9/11/2023
4.0.41 171 9/11/2023
4.0.40 239 9/11/2023
4.0.39 414 9/7/2023
4.0.38 251 9/6/2023
4.0.37 302 9/5/2023
4.0.36 188 9/5/2023
4.0.35 279 9/4/2023
4.0.34 323 9/1/2023
4.0.33 308 8/31/2023
4.0.32 274 8/30/2023
4.0.31 177 8/30/2023
4.0.30 303 8/29/2023
4.0.29 433 8/25/2023
4.0.28 366 8/23/2023
4.0.27 373 8/18/2023
4.0.26 260 8/17/2023
4.0.25 169 8/17/2023
4.0.24 174 8/17/2023
4.0.23 488 8/10/2023
4.0.22 285 8/9/2023
4.0.21 261 8/8/2023
4.0.20 197 8/8/2023
4.0.19 336 8/8/2023
4.0.18 402 8/7/2023
4.0.17 493 8/3/2023
4.0.16 426 7/26/2023
4.0.15 395 7/20/2023
4.0.14 401 7/18/2023
4.0.13 204 7/18/2023
4.0.12 192 7/18/2023
4.0.11 631 7/17/2023
4.0.10 207 7/14/2023
4.0.9 207 7/13/2023
4.0.8 197 7/13/2023
4.0.7 214 7/12/2023
4.0.6 209 7/12/2023
4.0.5 264 6/13/2023
4.0.4 1,294 1/30/2023
4.0.3 574 1/30/2023
4.0.2 579 1/27/2023
4.0.1 747 12/13/2022
4.0.0 563 12/12/2022
3.1.49 2,747 6/10/2022
3.1.47 1,876 4/20/2022
3.1.46 865 2/25/2022
3.1.45 2,074 1/11/2022
3.1.44 1,143 1/10/2022
3.1.43 1,197 10/12/2021
3.1.42 518 10/12/2021
3.1.41 1,784 6/17/2021
3.1.40 1,336 6/16/2021
3.1.39 1,219 6/16/2021
3.1.38 1,036 6/16/2021
3.1.37 801 6/15/2021
3.1.35 1,987 1/7/2021
3.1.34 1,452 12/16/2020
3.1.33 648 12/16/2020
3.1.32 1,255 12/14/2020
3.1.31 3,291 9/13/2020
3.1.30 1,778 6/19/2020
3.1.29 1,229 6/8/2020
3.1.28 2,527 5/12/2020
3.1.27 2,004 5/12/2020
3.1.26 1,523 4/28/2020
3.1.25 1,475 4/16/2020
3.1.23 1,425 4/16/2020
3.1.22 1,466 4/16/2020
3.1.21 1,207 4/15/2020
3.1.20 1,433 4/15/2020
3.1.19 1,507 4/14/2020
3.1.18 1,206 4/14/2020
3.1.17 695 4/14/2020
3.1.16 1,507 4/10/2020
3.1.15 1,523 4/10/2020
3.1.14 3,958 3/26/2020
3.1.13 1,541 3/26/2020
3.1.12 1,729 3/25/2020
3.1.11 1,216 3/25/2020
3.1.10 1,201 3/25/2020
3.1.9 1,646 3/25/2020
3.1.8 1,722 3/24/2020
3.1.7 2,342 3/21/2020
3.1.6 2,238 3/13/2020
3.1.5 1,234 3/13/2020
3.1.3 2,198 2/28/2020
3.1.1.2 696 2/28/2020
3.1.1 1,017 2/22/2020
3.1.0 1,260 2/21/2020
3.0.4 1,316 2/11/2020
3.0.3 980 2/11/2020
3.0.2 766 2/10/2020
3.0.1 1,723 1/9/2020
3.0.0 1,472 12/23/2019
2.0.18 2,723 6/19/2019
2.0.17 781 6/19/2019
2.0.16 2,204 4/17/2019
2.0.15 1,632 3/14/2019
2.0.14 844 2/22/2019
2.0.13 1,837 2/21/2019
2.0.12 818 2/21/2019
2.0.11 4,666 8/1/2018
2.0.10 1,841 8/1/2018
2.0.9 1,609 7/3/2018
2.0.8 2,082 6/26/2018
2.0.7 1,333 6/26/2018
2.0.6 1,878 6/14/2018
2.0.5 1,970 6/1/2018
2.0.4 2,262 5/22/2018
2.0.3 2,880 5/9/2018
2.0.2 2,549 2/15/2018
2.0.1 2,193 2/13/2018
2.0.0 2,912 1/2/2018
1.0.44 11,422 10/10/2017
1.0.42 1,142 10/10/2017
1.0.41 1,451 9/29/2017
1.0.40 4,434 9/19/2017
1.0.39 1,165 9/15/2017
1.0.36 1,152 9/15/2017
1.0.35 1,136 9/15/2017
1.0.34 3,414 7/3/2017
1.0.33 2,013 6/16/2017
1.0.32 1,970 6/16/2017
1.0.31 1,206 5/30/2017
1.0.28 1,858 5/30/2017
1.0.27 1,661 5/25/2017
1.0.26 1,928 5/24/2017
1.0.25 1,513 5/19/2017
1.0.24 1,201 5/19/2017
1.0.23 1,495 5/17/2017
1.0.20 1,301 5/8/2017
1.0.19 1,345 4/7/2017
1.0.18 1,909 3/22/2017
1.0.15 1,641 1/31/2017
1.0.14 1,330 1/24/2017
1.0.13 1,344 1/8/2017
1.0.12 1,311 1/6/2017
1.0.11 1,331 1/6/2017
1.0.10 1,298 1/3/2017
1.0.9 1,423 12/9/2016
1.0.8 1,249 12/1/2016
1.0.0 1,232 9/15/2017