SQLHelper.DB
4.0.70
See the version list below for details.
dotnet add package SQLHelper.DB --version 4.0.70
NuGet\Install-Package SQLHelper.DB -Version 4.0.70
<PackageReference Include="SQLHelper.DB" Version="4.0.70" />
paket add SQLHelper.DB --version 4.0.70
#r "nuget: SQLHelper.DB, 4.0.70"
// Install SQLHelper.DB as a Cake Addin #addin nuget:?package=SQLHelper.DB&version=4.0.70 // Install SQLHelper.DB as a Cake Tool #tool nuget:?package=SQLHelper.DB&version=4.0.70
SQLHelper
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:
- 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 | Versions 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. |
-
net6.0
- BigBook (>= 5.0.33)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.SqlClient (>= 5.1.2)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.ObjectPool (>= 8.0.0)
- Microsoft.SqlServer.Management.SqlParser (>= 170.9.0)
- SQLParser (>= 3.0.13)
- System.Data.Common (>= 4.3.0)
- System.Dynamic.Runtime (>= 4.3.0)
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.214 | 25 | 11/5/2024 |
4.0.213 | 63 | 11/4/2024 |
4.0.212 | 84 | 11/1/2024 |
4.0.211 | 80 | 10/31/2024 |
4.0.210 | 112 | 10/30/2024 |
4.0.209 | 118 | 10/29/2024 |
4.0.208 | 177 | 10/25/2024 |
4.0.207 | 195 | 10/21/2024 |
4.0.206 | 171 | 10/16/2024 |
4.0.205 | 187 | 10/11/2024 |
4.0.204 | 137 | 10/10/2024 |
4.0.203 | 135 | 10/9/2024 |
4.0.202 | 212 | 10/2/2024 |
4.0.201 | 145 | 10/1/2024 |
4.0.200 | 170 | 9/30/2024 |
4.0.199 | 205 | 9/24/2024 |
4.0.198 | 168 | 9/23/2024 |
4.0.197 | 221 | 9/17/2024 |
4.0.196 | 228 | 9/10/2024 |
4.0.195 | 225 | 9/6/2024 |
4.0.194 | 238 | 9/3/2024 |
4.0.193 | 216 | 8/30/2024 |
4.0.192 | 163 | 8/29/2024 |
4.0.191 | 161 | 8/28/2024 |
4.0.190 | 168 | 8/27/2024 |
4.0.189 | 182 | 8/26/2024 |
4.0.188 | 189 | 8/23/2024 |
4.0.187 | 251 | 8/21/2024 |
4.0.186 | 361 | 8/16/2024 |
4.0.185 | 170 | 8/15/2024 |
4.0.184 | 179 | 8/14/2024 |
4.0.183 | 173 | 8/5/2024 |
4.0.182 | 140 | 8/2/2024 |
4.0.181 | 154 | 8/1/2024 |
4.0.180 | 227 | 7/26/2024 |
4.0.179 | 174 | 7/24/2024 |
4.0.178 | 231 | 7/11/2024 |
4.0.177 | 153 | 7/10/2024 |
4.0.176 | 98 | 7/10/2024 |
4.0.175 | 185 | 7/9/2024 |
4.0.174 | 290 | 7/5/2024 |
4.0.173 | 213 | 7/2/2024 |
4.0.172 | 259 | 6/27/2024 |
4.0.171 | 168 | 6/26/2024 |
4.0.170 | 239 | 6/24/2024 |
4.0.169 | 1,017 | 6/19/2024 |
4.0.168 | 181 | 6/18/2024 |
4.0.167 | 180 | 6/17/2024 |
4.0.166 | 191 | 6/14/2024 |
4.0.165 | 165 | 6/13/2024 |
4.0.164 | 291 | 6/3/2024 |
4.0.163 | 191 | 5/31/2024 |
4.0.162 | 183 | 5/30/2024 |
4.0.161 | 170 | 5/29/2024 |
4.0.160 | 289 | 5/27/2024 |
4.0.159 | 222 | 5/23/2024 |
4.0.158 | 238 | 5/21/2024 |
4.0.157 | 212 | 5/17/2024 |
4.0.156 | 175 | 5/16/2024 |
4.0.155 | 175 | 5/15/2024 |
4.0.154 | 222 | 5/8/2024 |
4.0.153 | 185 | 5/7/2024 |
4.0.152 | 196 | 5/6/2024 |
4.0.151 | 181 | 5/3/2024 |
4.0.150 | 714 | 5/2/2024 |
4.0.149 | 192 | 5/1/2024 |
4.0.148 | 188 | 4/30/2024 |
4.0.147 | 221 | 4/29/2024 |
4.0.146 | 205 | 4/25/2024 |
4.0.145 | 272 | 4/16/2024 |
4.0.144 | 196 | 4/12/2024 |
4.0.143 | 158 | 4/12/2024 |
4.0.142 | 177 | 4/11/2024 |
4.0.141 | 197 | 4/10/2024 |
4.0.140 | 177 | 4/9/2024 |
4.0.139 | 258 | 4/1/2024 |
4.0.138 | 227 | 3/29/2024 |
4.0.137 | 212 | 3/26/2024 |
4.0.136 | 196 | 3/22/2024 |
4.0.135 | 104 | 3/22/2024 |
4.0.134 | 241 | 3/18/2024 |
4.0.133 | 186 | 3/15/2024 |
4.0.132 | 172 | 3/14/2024 |
4.0.131 | 205 | 3/13/2024 |
4.0.130 | 205 | 3/11/2024 |
4.0.129 | 178 | 3/8/2024 |
4.0.128 | 158 | 3/7/2024 |
4.0.127 | 127 | 3/6/2024 |
4.0.126 | 142 | 3/5/2024 |
4.0.125 | 135 | 3/4/2024 |
4.0.124 | 1,246 | 3/1/2024 |
4.0.123 | 195 | 2/29/2024 |
4.0.122 | 105 | 2/28/2024 |
4.0.121 | 142 | 2/27/2024 |
4.0.120 | 292 | 2/26/2024 |
4.0.119 | 106 | 2/23/2024 |
4.0.118 | 130 | 2/22/2024 |
4.0.117 | 112 | 2/21/2024 |
4.0.116 | 124 | 2/20/2024 |
4.0.115 | 108 | 2/20/2024 |
4.0.114 | 726 | 2/19/2024 |
4.0.113 | 116 | 2/19/2024 |
4.0.112 | 192 | 2/16/2024 |
4.0.111 | 111 | 2/15/2024 |
4.0.110 | 136 | 2/14/2024 |
4.0.109 | 318 | 2/13/2024 |
4.0.108 | 189 | 2/12/2024 |
4.0.107 | 129 | 2/9/2024 |
4.0.106 | 225 | 2/8/2024 |
4.0.105 | 106 | 2/7/2024 |
4.0.104 | 97 | 2/7/2024 |
4.0.103 | 108 | 2/6/2024 |
4.0.102 | 686 | 2/2/2024 |
4.0.101 | 162 | 2/1/2024 |
4.0.100 | 110 | 2/1/2024 |
4.0.99 | 112 | 1/31/2024 |
4.0.98 | 112 | 1/30/2024 |
4.0.97 | 446 | 1/25/2024 |
4.0.96 | 162 | 1/24/2024 |
4.0.95 | 119 | 1/23/2024 |
4.0.94 | 1,193 | 1/16/2024 |
4.0.93 | 111 | 1/16/2024 |
4.0.92 | 199 | 1/15/2024 |
4.0.91 | 205 | 1/12/2024 |
4.0.90 | 119 | 1/11/2024 |
4.0.89 | 119 | 1/10/2024 |
4.0.88 | 484 | 1/8/2024 |
4.0.87 | 588 | 12/26/2023 |
4.0.86 | 110 | 12/26/2023 |
4.0.85 | 112 | 12/25/2023 |
4.0.84 | 359 | 12/22/2023 |
4.0.83 | 300 | 12/15/2023 |
4.0.82 | 116 | 12/14/2023 |
4.0.81 | 101 | 12/14/2023 |
4.0.80 | 139 | 12/13/2023 |
4.0.79 | 119 | 12/12/2023 |
4.0.78 | 808 | 12/11/2023 |
4.0.77 | 295 | 12/6/2023 |
4.0.76 | 253 | 12/5/2023 |
4.0.75 | 407 | 11/24/2023 |
4.0.74 | 274 | 11/21/2023 |
4.0.73 | 244 | 11/20/2023 |
4.0.72 | 190 | 11/20/2023 |
4.0.71 | 218 | 11/17/2023 |
4.0.70 | 477 | 11/16/2023 |
4.0.69 | 199 | 11/14/2023 |
4.0.68 | 287 | 11/9/2023 |
4.0.67 | 238 | 11/8/2023 |
4.0.66 | 203 | 11/7/2023 |
4.0.65 | 199 | 11/6/2023 |
4.0.64 | 207 | 11/3/2023 |
4.0.63 | 296 | 11/1/2023 |
4.0.62 | 125 | 11/1/2023 |
4.0.61 | 240 | 10/31/2023 |
4.0.60 | 216 | 10/30/2023 |
4.0.59 | 208 | 10/27/2023 |
4.0.58 | 198 | 10/26/2023 |
4.0.57 | 206 | 10/25/2023 |
4.0.56 | 206 | 10/17/2023 |
4.0.55 | 259 | 10/16/2023 |
4.0.54 | 286 | 10/12/2023 |
4.0.53 | 199 | 10/11/2023 |
4.0.52 | 247 | 10/5/2023 |
4.0.51 | 288 | 9/26/2023 |
4.0.50 | 286 | 9/22/2023 |
4.0.49 | 208 | 9/20/2023 |
4.0.48 | 194 | 9/19/2023 |
4.0.47 | 118 | 9/19/2023 |
4.0.46 | 239 | 9/18/2023 |
4.0.45 | 287 | 9/14/2023 |
4.0.44 | 207 | 9/13/2023 |
4.0.43 | 209 | 9/12/2023 |
4.0.42 | 246 | 9/11/2023 |
4.0.41 | 136 | 9/11/2023 |
4.0.40 | 206 | 9/11/2023 |
4.0.39 | 372 | 9/7/2023 |
4.0.38 | 210 | 9/6/2023 |
4.0.37 | 265 | 9/5/2023 |
4.0.36 | 151 | 9/5/2023 |
4.0.35 | 242 | 9/4/2023 |
4.0.34 | 284 | 9/1/2023 |
4.0.33 | 269 | 8/31/2023 |
4.0.32 | 235 | 8/30/2023 |
4.0.31 | 140 | 8/30/2023 |
4.0.30 | 266 | 8/29/2023 |
4.0.29 | 393 | 8/25/2023 |
4.0.28 | 329 | 8/23/2023 |
4.0.27 | 333 | 8/18/2023 |
4.0.26 | 220 | 8/17/2023 |
4.0.25 | 131 | 8/17/2023 |
4.0.24 | 137 | 8/17/2023 |
4.0.23 | 448 | 8/10/2023 |
4.0.22 | 243 | 8/9/2023 |
4.0.21 | 218 | 8/8/2023 |
4.0.20 | 156 | 8/8/2023 |
4.0.19 | 296 | 8/8/2023 |
4.0.18 | 361 | 8/7/2023 |
4.0.17 | 452 | 8/3/2023 |
4.0.16 | 383 | 7/26/2023 |
4.0.15 | 350 | 7/20/2023 |
4.0.14 | 355 | 7/18/2023 |
4.0.13 | 162 | 7/18/2023 |
4.0.12 | 149 | 7/18/2023 |
4.0.11 | 587 | 7/17/2023 |
4.0.10 | 162 | 7/14/2023 |
4.0.9 | 163 | 7/13/2023 |
4.0.8 | 152 | 7/13/2023 |
4.0.7 | 168 | 7/12/2023 |
4.0.6 | 162 | 7/12/2023 |
4.0.5 | 211 | 6/13/2023 |
4.0.4 | 995 | 1/30/2023 |
4.0.3 | 521 | 1/30/2023 |
4.0.2 | 525 | 1/27/2023 |
4.0.1 | 695 | 12/13/2022 |
4.0.0 | 505 | 12/12/2022 |
3.1.49 | 2,655 | 6/10/2022 |
3.1.47 | 1,804 | 4/20/2022 |
3.1.46 | 790 | 2/25/2022 |
3.1.45 | 2,001 | 1/11/2022 |
3.1.44 | 1,068 | 1/10/2022 |
3.1.43 | 1,119 | 10/12/2021 |
3.1.42 | 442 | 10/12/2021 |
3.1.41 | 1,652 | 6/17/2021 |
3.1.40 | 1,263 | 6/16/2021 |
3.1.39 | 1,146 | 6/16/2021 |
3.1.38 | 960 | 6/16/2021 |
3.1.37 | 728 | 6/15/2021 |
3.1.35 | 1,905 | 1/7/2021 |
3.1.34 | 1,365 | 12/16/2020 |
3.1.33 | 562 | 12/16/2020 |
3.1.32 | 1,171 | 12/14/2020 |
3.1.31 | 3,191 | 9/13/2020 |
3.1.30 | 1,675 | 6/19/2020 |
3.1.29 | 1,140 | 6/8/2020 |
3.1.28 | 2,433 | 5/12/2020 |
3.1.27 | 1,910 | 5/12/2020 |
3.1.26 | 1,426 | 4/28/2020 |
3.1.25 | 1,381 | 4/16/2020 |
3.1.23 | 1,332 | 4/16/2020 |
3.1.22 | 1,373 | 4/16/2020 |
3.1.21 | 1,112 | 4/15/2020 |
3.1.20 | 1,338 | 4/15/2020 |
3.1.19 | 1,412 | 4/14/2020 |
3.1.18 | 1,111 | 4/14/2020 |
3.1.17 | 598 | 4/14/2020 |
3.1.16 | 1,412 | 4/10/2020 |
3.1.15 | 1,429 | 4/10/2020 |
3.1.14 | 3,857 | 3/26/2020 |
3.1.13 | 1,446 | 3/26/2020 |
3.1.12 | 1,632 | 3/25/2020 |
3.1.11 | 1,121 | 3/25/2020 |
3.1.10 | 1,104 | 3/25/2020 |
3.1.9 | 1,553 | 3/25/2020 |
3.1.8 | 1,629 | 3/24/2020 |
3.1.7 | 2,245 | 3/21/2020 |
3.1.6 | 2,141 | 3/13/2020 |
3.1.5 | 1,140 | 3/13/2020 |
3.1.3 | 2,100 | 2/28/2020 |
3.1.1.2 | 602 | 2/28/2020 |
3.1.1 | 923 | 2/22/2020 |
3.1.0 | 1,163 | 2/21/2020 |
3.0.4 | 1,219 | 2/11/2020 |
3.0.3 | 884 | 2/11/2020 |
3.0.2 | 671 | 2/10/2020 |
3.0.1 | 1,629 | 1/9/2020 |
3.0.0 | 1,351 | 12/23/2019 |
2.0.18 | 2,377 | 6/19/2019 |
2.0.17 | 681 | 6/19/2019 |
2.0.16 | 2,102 | 4/17/2019 |
2.0.15 | 1,531 | 3/14/2019 |
2.0.14 | 741 | 2/22/2019 |
2.0.13 | 1,736 | 2/21/2019 |
2.0.12 | 716 | 2/21/2019 |
2.0.11 | 4,465 | 8/1/2018 |
2.0.10 | 1,640 | 8/1/2018 |
2.0.9 | 1,309 | 7/3/2018 |
2.0.8 | 1,787 | 6/26/2018 |
2.0.7 | 1,036 | 6/26/2018 |
2.0.6 | 1,579 | 6/14/2018 |
2.0.5 | 1,671 | 6/1/2018 |
2.0.4 | 1,962 | 5/22/2018 |
2.0.3 | 2,571 | 5/9/2018 |
2.0.2 | 2,230 | 2/15/2018 |
2.0.1 | 1,885 | 2/13/2018 |
2.0.0 | 2,596 | 1/2/2018 |
1.0.44 | 11,210 | 10/10/2017 |
1.0.42 | 930 | 10/10/2017 |
1.0.41 | 1,235 | 9/29/2017 |
1.0.40 | 4,222 | 9/19/2017 |
1.0.39 | 949 | 9/15/2017 |
1.0.36 | 935 | 9/15/2017 |
1.0.35 | 926 | 9/15/2017 |
1.0.34 | 3,196 | 7/3/2017 |
1.0.33 | 1,794 | 6/16/2017 |
1.0.32 | 1,754 | 6/16/2017 |
1.0.31 | 991 | 5/30/2017 |
1.0.28 | 1,646 | 5/30/2017 |
1.0.27 | 1,444 | 5/25/2017 |
1.0.26 | 1,714 | 5/24/2017 |
1.0.25 | 1,297 | 5/19/2017 |
1.0.24 | 987 | 5/19/2017 |
1.0.23 | 1,279 | 5/17/2017 |
1.0.20 | 1,086 | 5/8/2017 |
1.0.19 | 1,131 | 4/7/2017 |
1.0.18 | 1,686 | 3/22/2017 |
1.0.15 | 1,425 | 1/31/2017 |
1.0.14 | 1,107 | 1/24/2017 |
1.0.13 | 1,127 | 1/8/2017 |
1.0.12 | 1,096 | 1/6/2017 |
1.0.11 | 1,115 | 1/6/2017 |
1.0.10 | 1,083 | 1/3/2017 |
1.0.9 | 1,206 | 12/9/2016 |
1.0.8 | 1,033 | 12/1/2016 |
1.0.0 | 1,015 | 9/15/2017 |