Using parameters.AddOutput

Oct 14, 2014 at 2:06 AM
I wasn't able to find any documentation or examples for using output parameters.
Once an output parameter is added how can I get it's value back?
Coordinator
Oct 16, 2014 at 4:03 PM
Edited Nov 3, 2014 at 8:04 PM
It is recommended to use this library through NuGet Library Package Manager. If you install the DLL from NuGet, NuGet Packages Manager will generate scaffolding, sample code and configuration into your project for a very quick start. Inside the sample code (DataAccess\DbPackage.sample.cs) you can see [A sample of output parameter]:
// To turn off following sample code in DEBUG mode, just add NO_SAMPLE into the project properties conditional compilation symbols

#region A sample of output parameter
internal static Tuple<string, int, byte> GetSampleSetting(this DbAccess dbAccess, string sampleDomain)
{
    const string sp = "GET_SAMPLE_SETTING";
    DbParameter outStartupMode = null;
    DbParameter outRefreshInterval = null;
    DbParameter outDegreeOfTaskParallelism = null;

    dbAccess.ExecuteNonQuery(GetProcedure(sp), parameters =>
        {
            parameters.Add("inSample_Domain", sampleDomain);

            outStartupMode = parameters.AddOutput("outStartup_Mode", 32);
            outRefreshInterval = parameters.AddOutput("outRefresh_Interval", DbType.Int32);
            outDegreeOfTaskParallelism = parameters.AddOutput("outParallelism_Degree", DbType.Byte);
        });

    return Tuple.Create(outStartupMode.Parameter<string>(),
        outRefreshInterval.Parameter<int>(),
        outDegreeOfTaskParallelism.Parameter<byte>());
}
#endregion