YGADO 1.3.1
See the version list below for details.
dotnet add package YGADO --version 1.3.1
NuGet\Install-Package YGADO -Version 1.3.1
<PackageReference Include="YGADO" Version="1.3.1" />
paket add YGADO --version 1.3.1
#r "nuget: YGADO, 1.3.1"
// Install YGADO as a Cake Addin #addin nuget:?package=YGADO&version=1.3.1 // Install YGADO as a Cake Tool #tool nuget:?package=YGADO&version=1.3.1
YGADO
A simple ADO to execute a stored procedure and return DataSet or Dictionary of output parameters
Installation
Include this package in the project file
Use code inside a Try catch block. For brevity, there is no try catch block in GetDataSet
Usage
IDBSPTool db = new DBSPTool(connStr);
Dictionary<string, object> inputParms = new Dictionary<string, object>()
{
{"Status", "Complete" }
};
Dictionary<string, SqlDbType> outputParms = new Dictionary<string, SqlDbType>()
{
{"ExecutedDate", SqlDbType.DateTime },
{"ExecuteStatus", SqlDbType.Bit }
};
var result = db.GetDataSet("USPGetEmplRecs", inputParms, outputParms);
Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
//or
IDBSPTool db = new DBSPTool(connStr);
var result = db.ExecSP("USPTest");
Examples
Test project is provided in the solution to illustrate how to invoke SP and get DataSet and output dictionary back
IDBSPTool Interface:
public interface IDBSPTool
{
Dictionary<string, object> ExecSP(SqlConnection sqlConn, string spName, Dictionary<string, object> inputParms = null, Dictionary<string, SqlDbType> outputParms = null, bool closeConnectionAfter = false);
string ExecSP(string sqlText);
Dictionary<string, object> ExecSP(string spName, Dictionary<string, object> inputParms = null, Dictionary<string, SqlDbType> outputParms = null);
DataSet GetDataSet(string sqlQuery, bool isQueryText);
Tuple<DataSet, Dictionary<string, object>, Exception> GetDataSet(string spName, Dictionary<string, object> inputParms = null, Dictionary<string, SqlDbType> outputParms = null);
}
Output:
The output is a Tuple<DataSet,Dictionary<string, object>, Exception> for GetDataSet with SP or Dictionary for ExecSP.
Dependencies
Microsoft.Data.SqlClient
Contributing
Any new ideas on how to enhance this class without adding much complexity, please adhere to SOLID principle
License
This project is licensed under the MIT License(LICENSE).
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
- Microsoft.Data.SqlClient (>= 5.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Bug fix to set the output parm size to 8000 when it is Varchar or nvarchar.