YGADO 1.3.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package YGADO --version 1.3.1                
NuGet\Install-Package YGADO -Version 1.3.1                
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="YGADO" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YGADO --version 1.3.1                
#r "nuget: YGADO, 1.3.1"                
#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 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 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. 
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.4.0 85 11/16/2024
1.3.3 91 10/9/2024
1.3.2 122 6/17/2024
1.3.1 107 6/17/2024
1.3.0 107 6/17/2024
1.2.0 118 6/1/2024
1.1.0 109 6/1/2024
1.0.0 116 5/31/2024

Bug fix to set the output parm size to 8000 when it is Varchar or nvarchar.