public void ExecuteProcedure(
string sprocName,
Dictionary<string, object> intParams,
Dictionary<string, object> outParams)
{
List<SugarParameter> pList = new List<SugarParameter>();
if (intParams != null)
{
pList = intParams.Select(
obj => new SugarParameter($@"@{obj.Key}", obj.Value))
.ToList();
}
if (outParams != null)
pList.AddRange(
outParams.Select(
obj => new SugarParameter($@"@{obj.Key}", obj.Value)
{
Direction = ParameterDirection.Output
}));
_unitOfWork.Db.Ado.UseStoredProcedure().ExecuteCommand(sprocName, pList);
foreach (var p in pList.Where(r => r.Direction == ParameterDirection.Output))
{
var pName = p.ParameterName.Substring(1);
if (outParams != null && outParams.ContainsKey(pName))
{
outParams[pName] = p.Value;
}
}
}