SQLHelper.DB
4.0.200
See the version list below for details.
dotnet add package SQLHelper.DB --version 4.0.200
NuGet\Install-Package SQLHelper.DB -Version 4.0.200
<PackageReference Include="SQLHelper.DB" Version="4.0.200" />
paket add SQLHelper.DB --version 4.0.200
#r "nuget: SQLHelper.DB, 4.0.200"
// Install SQLHelper.DB as a Cake Addin #addin nuget:?package=SQLHelper.DB&version=4.0.200 // Install SQLHelper.DB as a Cake Tool #tool nuget:?package=SQLHelper.DB&version=4.0.200
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.1.53)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.ObjectPool (>= 8.0.8)
- Microsoft.SqlServer.Management.SqlParser (>= 172.0.1)
- SQLParser (>= 3.0.19)
- 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 |
---|---|---|
5.0.8 | 127 | 11/26/2024 |
5.0.7 | 63 | 11/26/2024 |
5.0.6 | 196 | 11/24/2024 |
5.0.5 | 72 | 11/24/2024 |
5.0.4 | 100 | 11/23/2024 |
4.0.218 | 156 | 11/20/2024 |
4.0.217 | 109 | 11/12/2024 |
4.0.216 | 242 | 11/11/2024 |
4.0.215 | 136 | 11/6/2024 |
4.0.214 | 147 | 11/5/2024 |
4.0.213 | 134 | 11/4/2024 |
4.0.212 | 146 | 11/1/2024 |
4.0.211 | 131 | 10/31/2024 |
4.0.210 | 132 | 10/30/2024 |
4.0.209 | 129 | 10/29/2024 |
4.0.208 | 184 | 10/25/2024 |
4.0.207 | 203 | 10/21/2024 |
4.0.206 | 176 | 10/16/2024 |
4.0.205 | 194 | 10/11/2024 |
4.0.204 | 142 | 10/10/2024 |
4.0.203 | 140 | 10/9/2024 |
4.0.202 | 216 | 10/2/2024 |
4.0.201 | 150 | 10/1/2024 |
4.0.200 | 173 | 9/30/2024 |
4.0.199 | 208 | 9/24/2024 |
4.0.198 | 171 | 9/23/2024 |
4.0.197 | 225 | 9/17/2024 |
4.0.196 | 232 | 9/10/2024 |
4.0.195 | 227 | 9/6/2024 |
4.0.194 | 242 | 9/3/2024 |
4.0.193 | 219 | 8/30/2024 |
4.0.192 | 166 | 8/29/2024 |
4.0.191 | 163 | 8/28/2024 |
4.0.190 | 172 | 8/27/2024 |
4.0.189 | 186 | 8/26/2024 |
4.0.188 | 191 | 8/23/2024 |
4.0.187 | 254 | 8/21/2024 |
4.0.186 | 364 | 8/16/2024 |
4.0.185 | 172 | 8/15/2024 |
4.0.184 | 181 | 8/14/2024 |
4.0.183 | 176 | 8/5/2024 |
4.0.182 | 142 | 8/2/2024 |
4.0.181 | 158 | 8/1/2024 |
4.0.180 | 230 | 7/26/2024 |
4.0.179 | 176 | 7/24/2024 |
4.0.178 | 233 | 7/11/2024 |
4.0.177 | 155 | 7/10/2024 |
4.0.176 | 100 | 7/10/2024 |
4.0.175 | 188 | 7/9/2024 |
4.0.174 | 292 | 7/5/2024 |
4.0.173 | 215 | 7/2/2024 |
4.0.172 | 261 | 6/27/2024 |
4.0.171 | 170 | 6/26/2024 |
4.0.170 | 242 | 6/24/2024 |
4.0.169 | 1,056 | 6/19/2024 |
4.0.168 | 183 | 6/18/2024 |
4.0.167 | 184 | 6/17/2024 |
4.0.166 | 193 | 6/14/2024 |
4.0.165 | 167 | 6/13/2024 |
4.0.164 | 294 | 6/3/2024 |
4.0.163 | 194 | 5/31/2024 |
4.0.162 | 186 | 5/30/2024 |
4.0.161 | 172 | 5/29/2024 |
4.0.160 | 292 | 5/27/2024 |
4.0.159 | 225 | 5/23/2024 |
4.0.158 | 240 | 5/21/2024 |
4.0.157 | 215 | 5/17/2024 |
4.0.156 | 177 | 5/16/2024 |
4.0.155 | 177 | 5/15/2024 |
4.0.154 | 225 | 5/8/2024 |
4.0.153 | 187 | 5/7/2024 |
4.0.152 | 198 | 5/6/2024 |
4.0.151 | 183 | 5/3/2024 |
4.0.150 | 717 | 5/2/2024 |
4.0.149 | 196 | 5/1/2024 |
4.0.148 | 191 | 4/30/2024 |
4.0.147 | 224 | 4/29/2024 |
4.0.146 | 207 | 4/25/2024 |
4.0.145 | 274 | 4/16/2024 |
4.0.144 | 199 | 4/12/2024 |
4.0.143 | 160 | 4/12/2024 |
4.0.142 | 180 | 4/11/2024 |
4.0.141 | 201 | 4/10/2024 |
4.0.140 | 180 | 4/9/2024 |
4.0.139 | 262 | 4/1/2024 |
4.0.138 | 229 | 3/29/2024 |
4.0.137 | 215 | 3/26/2024 |
4.0.136 | 200 | 3/22/2024 |
4.0.135 | 108 | 3/22/2024 |
4.0.134 | 246 | 3/18/2024 |
4.0.133 | 191 | 3/15/2024 |
4.0.132 | 176 | 3/14/2024 |
4.0.131 | 208 | 3/13/2024 |
4.0.130 | 207 | 3/11/2024 |
4.0.129 | 184 | 3/8/2024 |
4.0.128 | 160 | 3/7/2024 |
4.0.127 | 130 | 3/6/2024 |
4.0.126 | 144 | 3/5/2024 |
4.0.125 | 142 | 3/4/2024 |
4.0.124 | 1,249 | 3/1/2024 |
4.0.123 | 197 | 2/29/2024 |
4.0.122 | 107 | 2/28/2024 |
4.0.121 | 146 | 2/27/2024 |
4.0.120 | 294 | 2/26/2024 |
4.0.119 | 109 | 2/23/2024 |
4.0.118 | 133 | 2/22/2024 |
4.0.117 | 115 | 2/21/2024 |
4.0.116 | 126 | 2/20/2024 |
4.0.115 | 110 | 2/20/2024 |
4.0.114 | 730 | 2/19/2024 |
4.0.113 | 120 | 2/19/2024 |
4.0.112 | 195 | 2/16/2024 |
4.0.111 | 113 | 2/15/2024 |
4.0.110 | 138 | 2/14/2024 |
4.0.109 | 321 | 2/13/2024 |
4.0.108 | 192 | 2/12/2024 |
4.0.107 | 133 | 2/9/2024 |
4.0.106 | 229 | 2/8/2024 |
4.0.105 | 109 | 2/7/2024 |
4.0.104 | 100 | 2/7/2024 |
4.0.103 | 110 | 2/6/2024 |
4.0.102 | 689 | 2/2/2024 |
4.0.101 | 164 | 2/1/2024 |
4.0.100 | 113 | 2/1/2024 |
4.0.99 | 117 | 1/31/2024 |
4.0.98 | 114 | 1/30/2024 |
4.0.97 | 451 | 1/25/2024 |
4.0.96 | 165 | 1/24/2024 |
4.0.95 | 123 | 1/23/2024 |
4.0.94 | 1,195 | 1/16/2024 |
4.0.93 | 113 | 1/16/2024 |
4.0.92 | 201 | 1/15/2024 |
4.0.91 | 208 | 1/12/2024 |
4.0.90 | 122 | 1/11/2024 |
4.0.89 | 123 | 1/10/2024 |
4.0.88 | 488 | 1/8/2024 |
4.0.87 | 590 | 12/26/2023 |
4.0.86 | 114 | 12/26/2023 |
4.0.85 | 117 | 12/25/2023 |
4.0.84 | 363 | 12/22/2023 |
4.0.83 | 303 | 12/15/2023 |
4.0.82 | 119 | 12/14/2023 |
4.0.81 | 103 | 12/14/2023 |
4.0.80 | 141 | 12/13/2023 |
4.0.79 | 122 | 12/12/2023 |
4.0.78 | 812 | 12/11/2023 |
4.0.77 | 298 | 12/6/2023 |
4.0.76 | 255 | 12/5/2023 |
4.0.75 | 410 | 11/24/2023 |
4.0.74 | 278 | 11/21/2023 |
4.0.73 | 247 | 11/20/2023 |
4.0.72 | 192 | 11/20/2023 |
4.0.71 | 221 | 11/17/2023 |
4.0.70 | 499 | 11/16/2023 |
4.0.69 | 201 | 11/14/2023 |
4.0.68 | 289 | 11/9/2023 |
4.0.67 | 241 | 11/8/2023 |
4.0.66 | 206 | 11/7/2023 |
4.0.65 | 202 | 11/6/2023 |
4.0.64 | 211 | 11/3/2023 |
4.0.63 | 299 | 11/1/2023 |
4.0.62 | 128 | 11/1/2023 |
4.0.61 | 242 | 10/31/2023 |
4.0.60 | 219 | 10/30/2023 |
4.0.59 | 210 | 10/27/2023 |
4.0.58 | 200 | 10/26/2023 |
4.0.57 | 209 | 10/25/2023 |
4.0.56 | 209 | 10/17/2023 |
4.0.55 | 261 | 10/16/2023 |
4.0.54 | 289 | 10/12/2023 |
4.0.53 | 202 | 10/11/2023 |
4.0.52 | 250 | 10/5/2023 |
4.0.51 | 291 | 9/26/2023 |
4.0.50 | 289 | 9/22/2023 |
4.0.49 | 211 | 9/20/2023 |
4.0.48 | 196 | 9/19/2023 |
4.0.47 | 121 | 9/19/2023 |
4.0.46 | 242 | 9/18/2023 |
4.0.45 | 289 | 9/14/2023 |
4.0.44 | 210 | 9/13/2023 |
4.0.43 | 211 | 9/12/2023 |
4.0.42 | 250 | 9/11/2023 |
4.0.41 | 140 | 9/11/2023 |
4.0.40 | 208 | 9/11/2023 |
4.0.39 | 376 | 9/7/2023 |
4.0.38 | 213 | 9/6/2023 |
4.0.37 | 267 | 9/5/2023 |
4.0.36 | 153 | 9/5/2023 |
4.0.35 | 245 | 9/4/2023 |
4.0.34 | 286 | 9/1/2023 |
4.0.33 | 271 | 8/31/2023 |
4.0.32 | 237 | 8/30/2023 |
4.0.31 | 142 | 8/30/2023 |
4.0.30 | 268 | 8/29/2023 |
4.0.29 | 398 | 8/25/2023 |
4.0.28 | 332 | 8/23/2023 |
4.0.27 | 336 | 8/18/2023 |
4.0.26 | 222 | 8/17/2023 |
4.0.25 | 133 | 8/17/2023 |
4.0.24 | 139 | 8/17/2023 |
4.0.23 | 451 | 8/10/2023 |
4.0.22 | 246 | 8/9/2023 |
4.0.21 | 221 | 8/8/2023 |
4.0.20 | 159 | 8/8/2023 |
4.0.19 | 298 | 8/8/2023 |
4.0.18 | 363 | 8/7/2023 |
4.0.17 | 455 | 8/3/2023 |
4.0.16 | 385 | 7/26/2023 |
4.0.15 | 353 | 7/20/2023 |
4.0.14 | 358 | 7/18/2023 |
4.0.13 | 165 | 7/18/2023 |
4.0.12 | 152 | 7/18/2023 |
4.0.11 | 589 | 7/17/2023 |
4.0.10 | 164 | 7/14/2023 |
4.0.9 | 165 | 7/13/2023 |
4.0.8 | 154 | 7/13/2023 |
4.0.7 | 171 | 7/12/2023 |
4.0.6 | 165 | 7/12/2023 |
4.0.5 | 215 | 6/13/2023 |
4.0.4 | 997 | 1/30/2023 |
4.0.3 | 523 | 1/30/2023 |
4.0.2 | 528 | 1/27/2023 |
4.0.1 | 697 | 12/13/2022 |
4.0.0 | 507 | 12/12/2022 |
3.1.49 | 2,661 | 6/10/2022 |
3.1.47 | 1,806 | 4/20/2022 |
3.1.46 | 792 | 2/25/2022 |
3.1.45 | 2,003 | 1/11/2022 |
3.1.44 | 1,071 | 1/10/2022 |
3.1.43 | 1,122 | 10/12/2021 |
3.1.42 | 445 | 10/12/2021 |
3.1.41 | 1,655 | 6/17/2021 |
3.1.40 | 1,266 | 6/16/2021 |
3.1.39 | 1,148 | 6/16/2021 |
3.1.38 | 963 | 6/16/2021 |
3.1.37 | 731 | 6/15/2021 |
3.1.35 | 1,907 | 1/7/2021 |
3.1.34 | 1,367 | 12/16/2020 |
3.1.33 | 564 | 12/16/2020 |
3.1.32 | 1,173 | 12/14/2020 |
3.1.31 | 3,201 | 9/13/2020 |
3.1.30 | 1,677 | 6/19/2020 |
3.1.29 | 1,143 | 6/8/2020 |
3.1.28 | 2,435 | 5/12/2020 |
3.1.27 | 1,912 | 5/12/2020 |
3.1.26 | 1,428 | 4/28/2020 |
3.1.25 | 1,384 | 4/16/2020 |
3.1.23 | 1,334 | 4/16/2020 |
3.1.22 | 1,375 | 4/16/2020 |
3.1.21 | 1,114 | 4/15/2020 |
3.1.20 | 1,340 | 4/15/2020 |
3.1.19 | 1,415 | 4/14/2020 |
3.1.18 | 1,114 | 4/14/2020 |
3.1.17 | 600 | 4/14/2020 |
3.1.16 | 1,414 | 4/10/2020 |
3.1.15 | 1,431 | 4/10/2020 |
3.1.14 | 3,859 | 3/26/2020 |
3.1.13 | 1,449 | 3/26/2020 |
3.1.12 | 1,634 | 3/25/2020 |
3.1.11 | 1,123 | 3/25/2020 |
3.1.10 | 1,107 | 3/25/2020 |
3.1.9 | 1,555 | 3/25/2020 |
3.1.8 | 1,631 | 3/24/2020 |
3.1.7 | 2,247 | 3/21/2020 |
3.1.6 | 2,143 | 3/13/2020 |
3.1.5 | 1,142 | 3/13/2020 |
3.1.3 | 2,102 | 2/28/2020 |
3.1.1.2 | 604 | 2/28/2020 |
3.1.1 | 925 | 2/22/2020 |
3.1.0 | 1,165 | 2/21/2020 |
3.0.4 | 1,221 | 2/11/2020 |
3.0.3 | 886 | 2/11/2020 |
3.0.2 | 673 | 2/10/2020 |
3.0.1 | 1,631 | 1/9/2020 |
3.0.0 | 1,357 | 12/23/2019 |
2.0.18 | 2,406 | 6/19/2019 |
2.0.17 | 684 | 6/19/2019 |
2.0.16 | 2,104 | 4/17/2019 |
2.0.15 | 1,533 | 3/14/2019 |
2.0.14 | 743 | 2/22/2019 |
2.0.13 | 1,738 | 2/21/2019 |
2.0.12 | 718 | 2/21/2019 |
2.0.11 | 4,467 | 8/1/2018 |
2.0.10 | 1,642 | 8/1/2018 |
2.0.9 | 1,311 | 7/3/2018 |
2.0.8 | 1,789 | 6/26/2018 |
2.0.7 | 1,038 | 6/26/2018 |
2.0.6 | 1,581 | 6/14/2018 |
2.0.5 | 1,673 | 6/1/2018 |
2.0.4 | 1,964 | 5/22/2018 |
2.0.3 | 2,573 | 5/9/2018 |
2.0.2 | 2,236 | 2/15/2018 |
2.0.1 | 1,887 | 2/13/2018 |
2.0.0 | 2,598 | 1/2/2018 |
1.0.44 | 11,212 | 10/10/2017 |
1.0.42 | 932 | 10/10/2017 |
1.0.41 | 1,239 | 9/29/2017 |
1.0.40 | 4,224 | 9/19/2017 |
1.0.39 | 951 | 9/15/2017 |
1.0.36 | 939 | 9/15/2017 |
1.0.35 | 928 | 9/15/2017 |
1.0.34 | 3,198 | 7/3/2017 |
1.0.33 | 1,798 | 6/16/2017 |
1.0.32 | 1,756 | 6/16/2017 |
1.0.31 | 995 | 5/30/2017 |
1.0.28 | 1,648 | 5/30/2017 |
1.0.27 | 1,446 | 5/25/2017 |
1.0.26 | 1,716 | 5/24/2017 |
1.0.25 | 1,299 | 5/19/2017 |
1.0.24 | 989 | 5/19/2017 |
1.0.23 | 1,281 | 5/17/2017 |
1.0.20 | 1,088 | 5/8/2017 |
1.0.19 | 1,133 | 4/7/2017 |
1.0.18 | 1,689 | 3/22/2017 |
1.0.15 | 1,427 | 1/31/2017 |
1.0.14 | 1,111 | 1/24/2017 |
1.0.13 | 1,129 | 1/8/2017 |
1.0.12 | 1,098 | 1/6/2017 |
1.0.11 | 1,117 | 1/6/2017 |
1.0.10 | 1,085 | 1/3/2017 |
1.0.9 | 1,210 | 12/9/2016 |
1.0.8 | 1,037 | 12/1/2016 |
1.0.0 | 1,017 | 9/15/2017 |