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                
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="BlueGroup.ClsDBSupport.SQLServer" Version="1.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlueGroup.ClsDBSupport.SQLServer --version 1.0.7                
#r "nuget: BlueGroup.ClsDBSupport.SQLServer, 1.0.7"                
#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 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 or ERROR 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 79 12/11/2024
1.0.4 80 12/11/2024
1.0.3 96 11/7/2024
1.0.2 136 8/9/2024
1.0.0 120 6/12/2024