I want to execute a stored procedure in Entity Framework and for that, I am using this code:
public dynamic ExecSp(SqlParameter[] Para, string SpName)
{
try
{
var _data = Context.SqlQuery<dynamic>("exec "+ SpName + " "+ string.Join(",", Para.Select(m=>m.ParameterName)), Para);
return _data
}
catch (Exception ex)
{
throw ex;
}
}
In my code the stored procedure name and parameters are dynamic. When I execute the stored procedure an {object}
is returned.
I want to map the {object}
value to property and value so I can easily use the result.