BlueGroup.ClsDBSupport.SQLServer
1.0.7
dotnet add package BlueGroup.ClsDBSupport.SQLServer --version 1.0.7
NuGet\Install-Package BlueGroup.ClsDBSupport.SQLServer -Version 1.0.7
<PackageReference Include="BlueGroup.ClsDBSupport.SQLServer" Version="1.0.7" />
paket add BlueGroup.ClsDBSupport.SQLServer --version 1.0.7
#r "nuget: BlueGroup.ClsDBSupport.SQLServer, 1.0.7"
// Install BlueGroup.ClsDBSupport.SQLServer as a Cake Addin #addin nuget:?package=BlueGroup.ClsDBSupport.SQLServer&version=1.0.7 // Install BlueGroup.ClsDBSupport.SQLServer as a Cake Tool #tool nuget:?package=BlueGroup.ClsDBSupport.SQLServer&version=1.0.7
BlueGroup.ClsDBSupport.SQLServer
BlueGroup.ClsDBSupport.SQLServer is an open-source library used to access and operate on SQL Server DataBases. It is a wrapper for the BlueGroup.ClsDBSupport.Base package, specific for SQL Server DataBases.
How To Use
Just add the package to your project via NuGet Package Manager.
The DataBase Connection String must be provided as a parameter of the constructor.
Note that by default the Encryption setting of the connection string is set to true
, so if an error regarding non-authorized certificates appears when creating the SQLServerDBClient
object consider adding Encryption=false
to the connection string.
Methods
Query
This method is used to retrieve multiple records from any DB Table. Only SELECT
statements should be used as queries. Results of the query are returned as a DataSet inside a specific structure.
Query<T>
This method is used to retrieve multiple records from any DB Table. Only SELECT
statements should be used as queries. Results of the query are returned as a List<T> inside a specific structure. Note that, in this case, the DataBase columns must have the same name of the object's properties, or the object's properties must be marked with the attribute DbColumn("COLUMN_NAME")
or DbNullableColumn("COLUMN_NAME")
for nullable columns.
ExecCommand
This method is used to perform all the operations on DB objects and records (INSERT
, DELETE
, UPDATE
, ALTER TABLE
, etc...).
ScalarQuery
This method is used to retrieve a single value from a DB Table (the value of a single column of a Table for a specific record); the value is returned as a string
inside a specific structure.
ScalarQuery<T>
This method is used to retrieve a single record from a DB Table; the value is returned as an object of type T inside a specific structure. Note that, in this case, the DataBase columns must have the same name of the object's properties, or the object's properties must be marked with the attribute DbColumn("COLUMN_NAME")
or DbNullableColumn("COLUMN_NAME")
for nullable columns.
ExecCommandList
This method is used to perform several commands in a single transaction. If all commands have successful response, the transaction is committed, while if one (or more) fail, the transaction is rolled back. Commands must be passed to the method as a List<string>
and they must be enlisted in the desired order of execution.
Return Values
All methods return a specific return structure, which inherits from a generic ReturnStruct class. The properties of the generic ReturnStruct class (which are inherited by ALL specific return structures) are:
- RetVal: it can assume either
SUCCESS
orERROR
values, according to the result of the query/command; - Message: if the result is
ERROR
, it contains the error message; - LastCommand: contains the last executed command. If you are trying to execute a list of commands and something goes wrong, it contains the command that resulted in the error.
The specific return structures are the following (with the additional specific properties):
ReturnStructQuery
For the Query method.
- RetDS: a
DataSet
containing the results of the query; - RowsFetched: the number of rows fetched by the query. It is equal to
RetDS.Tables[0].Rows.Count
.
This class also has a CheckExistsResult() method, that returns true if the RetDS object is not null, contains at least one table with at least one row, false otherwise.
ReturnStructQuery<T>
For the Query<T> method.
- RetList: a
List<T>
containing the results of the query; - RowsFetched: the number of rows fetched by the query. It is equal to
RetList.Count
.
This class also has a CheckExistsResult() method, that returns true if the RetList object is not null and contains at least one element, false otherwise.
ReturnStructExecCommand
For the ExecCommand method.
- RowsAffected: the number of rows affected by the executed command.
ReturnStructScalarQuery
For the ScalarQuery method.
- ResultValue: a
string
containing the single result of the query.
ReturnStructScalarQuery<T>
For the ScalarQuery<T> method.
- ResultValue: a
T
object which is the result of the query.
ReturnStructExecCommandList
For the ExecCommandList method.
- RowsAffected: a
List<int>
containing the number of rows affected by each executed command in the corresponding list. - TotalRowsAffected: the total number of rows affected by all executed commands.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- BlueGroup.ClsDBSupport.Base (>= 1.0.4)
-
.NETFramework 4.5
- BlueGroup.ClsDBSupport.Base (>= 1.0.4)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Microsoft.NETCore.Targets (>= 5.0.0)
- System.Runtime (>= 4.3.1)
- System.Runtime.Extensions (>= 4.3.1)
-
.NETFramework 4.6.2
- Azure.Core (>= 1.44.1)
- Azure.Identity (>= 1.13.1)
- BlueGroup.ClsDBSupport.Base (>= 1.0.4)
- Microsoft.Bcl.TimeProvider (>= 9.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Identity.Client (>= 4.66.2)
- Microsoft.Identity.Client.Extensions.Msal (>= 4.66.2)
- Microsoft.IdentityModel.Abstractions (>= 8.3.0)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.3.0)
- Microsoft.IdentityModel.Protocols (>= 8.3.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.3.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Microsoft.NETCore.Targets (>= 5.0.0)
- System.Buffers (>= 4.6.0)
- System.ClientModel (>= 1.2.1)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.Diagnostics.DiagnosticSource (>= 9.0.0)
- System.Memory (>= 4.6.0)
- System.Memory.Data (>= 9.0.0)
- System.Runtime (>= 4.3.1)
- System.Runtime.Caching (>= 9.0.0)
- System.Runtime.Extensions (>= 4.3.1)
- System.Security.AccessControl (>= 6.0.1)
- System.Security.Cryptography.Algorithms (>= 4.3.1)
- System.Security.Cryptography.OpenSsl (>= 5.0.0)
- System.Security.Cryptography.X509Certificates (>= 4.3.2)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
- System.Threading.Tasks.Extensions (>= 4.6.0)
-
.NETStandard 2.1
- Azure.Core (>= 1.44.1)
- Azure.Identity (>= 1.13.1)
- BlueGroup.ClsDBSupport.Base (>= 1.0.4)
- Microsoft.Bcl.TimeProvider (>= 9.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Identity.Client (>= 4.66.2)
- Microsoft.Identity.Client.Extensions.Msal (>= 4.66.2)
- Microsoft.IdentityModel.Abstractions (>= 8.3.0)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.3.0)
- Microsoft.IdentityModel.Protocols (>= 8.3.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.3.0)
- Microsoft.NETCore.Platforms (>= 7.0.4)
- Microsoft.NETCore.Targets (>= 5.0.0)
- runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- runtime.native.System (>= 4.3.1)
- runtime.native.System.Net.Http (>= 4.3.1)
- runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3)
- System.Buffers (>= 4.6.0)
- System.ClientModel (>= 1.2.1)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.Diagnostics.DiagnosticSource (>= 9.0.0)
- System.Memory (>= 4.6.0)
- System.Memory.Data (>= 9.0.0)
- System.Runtime (>= 4.3.1)
- System.Runtime.Caching (>= 9.0.0)
- System.Runtime.Extensions (>= 4.3.1)
- System.Security.AccessControl (>= 6.0.1)
- System.Security.Cryptography.Algorithms (>= 4.3.1)
- System.Security.Cryptography.OpenSsl (>= 5.0.0)
- System.Security.Cryptography.X509Certificates (>= 4.3.2)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
- System.Threading.Tasks.Extensions (>= 4.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.