YGADO 1.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package YGADO --version 1.3.2                
NuGet\Install-Package YGADO -Version 1.3.2                
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.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YGADO --version 1.3.2                
#r "nuget: YGADO, 1.3.2"                
#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.2

// Install YGADO as a Cake Tool
#tool nuget:?package=YGADO&version=1.3.2                

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.3.3 82 10/9/2024
1.3.2 118 6/17/2024
1.3.1 103 6/17/2024
1.3.0 103 6/17/2024
1.2.0 114 6/1/2024
1.1.0 105 6/1/2024
1.0.0 112 5/31/2024

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