SQLHelper.DB 4.0.145

dotnet add package SQLHelper.DB --version 4.0.145
NuGet\Install-Package SQLHelper.DB -Version 4.0.145
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.145" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SQLHelper.DB --version 4.0.145
#r "nuget: SQLHelper.DB, 4.0.145"
#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.
// Install SQLHelper.DB as a Cake Addin
#addin nuget:?package=SQLHelper.DB&version=4.0.145

// Install SQLHelper.DB as a Cake Tool
#tool nuget:?package=SQLHelper.DB&version=4.0.145

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. 
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
4.0.145 103 4/16/2024
4.0.144 145 4/12/2024
4.0.143 112 4/12/2024
4.0.142 129 4/11/2024
4.0.141 137 4/10/2024
4.0.140 133 4/9/2024
4.0.139 186 4/1/2024
4.0.138 164 3/29/2024
4.0.137 156 3/26/2024
4.0.136 151 3/22/2024
4.0.135 79 3/22/2024
4.0.134 193 3/18/2024
4.0.133 138 3/15/2024
4.0.132 132 3/14/2024
4.0.131 151 3/13/2024
4.0.130 144 3/11/2024
4.0.129 135 3/8/2024
4.0.128 110 3/7/2024
4.0.127 87 3/6/2024
4.0.126 103 3/5/2024
4.0.125 91 3/4/2024
4.0.124 812 3/1/2024
4.0.123 135 2/29/2024
4.0.122 84 2/28/2024
4.0.121 108 2/27/2024
4.0.120 218 2/26/2024
4.0.119 94 2/23/2024
4.0.118 97 2/22/2024
4.0.117 87 2/21/2024
4.0.116 95 2/20/2024
4.0.115 73 2/20/2024
4.0.114 542 2/19/2024
4.0.113 88 2/19/2024
4.0.112 145 2/16/2024
4.0.111 97 2/15/2024
4.0.110 100 2/14/2024
4.0.109 246 2/13/2024
4.0.108 137 2/12/2024
4.0.107 99 2/9/2024
4.0.106 158 2/8/2024
4.0.105 79 2/7/2024
4.0.104 79 2/7/2024
4.0.103 81 2/6/2024
4.0.102 519 2/2/2024
4.0.101 121 2/1/2024
4.0.100 83 2/1/2024
4.0.99 88 1/31/2024
4.0.98 82 1/30/2024
4.0.97 341 1/25/2024
4.0.96 115 1/24/2024
4.0.95 84 1/23/2024
4.0.94 939 1/16/2024
4.0.93 82 1/16/2024
4.0.92 151 1/15/2024
4.0.91 155 1/12/2024
4.0.90 94 1/11/2024
4.0.89 96 1/10/2024
4.0.88 380 1/8/2024
4.0.87 477 12/26/2023
4.0.86 81 12/26/2023
4.0.85 88 12/25/2023
4.0.84 276 12/22/2023
4.0.83 237 12/15/2023
4.0.82 91 12/14/2023
4.0.81 77 12/14/2023
4.0.80 102 12/13/2023
4.0.79 92 12/12/2023
4.0.78 634 12/11/2023
4.0.77 243 12/6/2023
4.0.76 190 12/5/2023
4.0.75 314 11/24/2023
4.0.74 205 11/21/2023
4.0.73 188 11/20/2023
4.0.72 150 11/20/2023
4.0.71 164 11/17/2023
4.0.70 304 11/16/2023
4.0.69 140 11/14/2023
4.0.68 200 11/9/2023
4.0.67 183 11/8/2023
4.0.66 156 11/7/2023
4.0.65 151 11/6/2023
4.0.64 160 11/3/2023
4.0.63 221 11/1/2023
4.0.62 102 11/1/2023
4.0.61 181 10/31/2023
4.0.60 173 10/30/2023
4.0.59 157 10/27/2023
4.0.58 154 10/26/2023
4.0.57 155 10/25/2023
4.0.56 163 10/17/2023
4.0.55 205 10/16/2023
4.0.54 222 10/12/2023
4.0.53 155 10/11/2023
4.0.52 201 10/5/2023
4.0.51 221 9/26/2023
4.0.50 221 9/22/2023
4.0.49 173 9/20/2023
4.0.48 151 9/19/2023
4.0.47 93 9/19/2023
4.0.46 191 9/18/2023
4.0.45 222 9/14/2023
4.0.44 159 9/13/2023
4.0.43 162 9/12/2023
4.0.42 203 9/11/2023
4.0.41 107 9/11/2023
4.0.40 159 9/11/2023
4.0.39 304 9/7/2023
4.0.38 171 9/6/2023
4.0.37 216 9/5/2023
4.0.36 119 9/5/2023
4.0.35 186 9/4/2023
4.0.34 223 9/1/2023
4.0.33 217 8/31/2023
4.0.32 191 8/30/2023
4.0.31 112 8/30/2023
4.0.30 220 8/29/2023
4.0.29 312 8/25/2023
4.0.28 275 8/23/2023
4.0.27 271 8/18/2023
4.0.26 178 8/17/2023
4.0.25 106 8/17/2023
4.0.24 110 8/17/2023
4.0.23 360 8/10/2023
4.0.22 201 8/9/2023
4.0.21 190 8/8/2023
4.0.20 134 8/8/2023
4.0.19 235 8/8/2023
4.0.18 294 8/7/2023
4.0.17 393 8/3/2023
4.0.16 316 7/26/2023
4.0.15 292 7/20/2023
4.0.14 283 7/18/2023
4.0.13 136 7/18/2023
4.0.12 119 7/18/2023
4.0.11 461 7/17/2023
4.0.10 134 7/14/2023
4.0.9 138 7/13/2023
4.0.8 130 7/13/2023
4.0.7 139 7/12/2023
4.0.6 135 7/12/2023
4.0.5 186 6/13/2023
4.0.4 923 1/30/2023
4.0.3 478 1/30/2023
4.0.2 476 1/27/2023
4.0.1 646 12/13/2022
4.0.0 464 12/12/2022
3.1.49 2,557 6/10/2022
3.1.47 1,738 4/20/2022
3.1.46 758 2/25/2022
3.1.45 1,931 1/11/2022
3.1.44 1,014 1/10/2022
3.1.43 1,076 10/12/2021
3.1.42 422 10/12/2021
3.1.41 1,584 6/17/2021
3.1.40 1,194 6/16/2021
3.1.39 1,087 6/16/2021
3.1.38 908 6/16/2021
3.1.37 692 6/15/2021
3.1.35 1,841 1/7/2021
3.1.34 1,290 12/16/2020
3.1.33 535 12/16/2020
3.1.32 1,114 12/14/2020
3.1.31 2,976 9/13/2020
3.1.30 1,595 6/19/2020
3.1.29 1,104 6/8/2020
3.1.28 2,314 5/12/2020
3.1.27 1,834 5/12/2020
3.1.26 1,372 4/28/2020
3.1.25 1,329 4/16/2020
3.1.23 1,267 4/16/2020
3.1.22 1,307 4/16/2020
3.1.21 1,065 4/15/2020
3.1.20 1,280 4/15/2020
3.1.19 1,356 4/14/2020
3.1.18 1,066 4/14/2020
3.1.17 578 4/14/2020
3.1.16 1,351 4/10/2020
3.1.15 1,379 4/10/2020
3.1.14 3,708 3/26/2020
3.1.13 1,393 3/26/2020
3.1.12 1,563 3/25/2020
3.1.11 1,059 3/25/2020
3.1.10 1,048 3/25/2020
3.1.9 1,497 3/25/2020
3.1.8 1,556 3/24/2020
3.1.7 2,168 3/21/2020
3.1.6 2,062 3/13/2020
3.1.5 1,078 3/13/2020
3.1.3 2,011 2/28/2020
3.1.1.2 583 2/28/2020
3.1.1 892 2/22/2020
3.1.0 1,115 2/21/2020
3.0.4 1,176 2/11/2020
3.0.3 845 2/11/2020
3.0.2 648 2/10/2020
3.0.1 1,571 1/9/2020
3.0.0 1,271 12/23/2019
2.0.18 1,931 6/19/2019
2.0.17 656 6/19/2019
2.0.16 2,019 4/17/2019
2.0.15 1,474 3/14/2019
2.0.14 715 2/22/2019
2.0.13 1,666 2/21/2019
2.0.12 686 2/21/2019
2.0.11 4,307 8/1/2018
2.0.10 1,564 8/1/2018
2.0.9 1,269 7/3/2018
2.0.8 1,708 6/26/2018
2.0.7 1,001 6/26/2018
2.0.6 1,526 6/14/2018
2.0.5 1,599 6/1/2018
2.0.4 1,901 5/22/2018
2.0.3 2,489 5/9/2018
2.0.2 2,156 2/15/2018
2.0.1 1,800 2/13/2018
2.0.0 2,496 1/2/2018
1.0.44 10,832 10/10/2017
1.0.42 903 10/10/2017
1.0.41 1,185 9/29/2017
1.0.40 4,097 9/19/2017
1.0.39 921 9/15/2017
1.0.36 909 9/15/2017
1.0.35 892 9/15/2017
1.0.34 3,106 7/3/2017
1.0.33 1,719 6/16/2017
1.0.32 1,668 6/16/2017
1.0.31 959 5/30/2017
1.0.28 1,574 5/30/2017
1.0.27 1,381 5/25/2017
1.0.26 1,604 5/24/2017
1.0.25 1,237 5/19/2017
1.0.24 960 5/19/2017
1.0.23 1,233 5/17/2017
1.0.20 1,072 5/8/2017
1.0.19 1,105 4/7/2017
1.0.18 1,625 3/22/2017
1.0.15 1,385 1/31/2017
1.0.14 1,089 1/24/2017
1.0.13 1,089 1/8/2017
1.0.12 1,056 1/6/2017
1.0.11 1,076 1/6/2017
1.0.10 1,047 1/3/2017
1.0.9 1,176 12/9/2016
1.0.8 1,019 12/1/2016
1.0.0 976 9/15/2017