HighwayFramework / Highway.Data

The fastest and smoothest way to great architecture
http://hwyfwk.com
MIT License
73 stars 30 forks source link

Handling Output Parameters From A Stored Procedure #90

Closed daudirsch closed 8 years ago

daudirsch commented 8 years ago

I have an older stored proc that returns a set of records as well as an output value. Is it possible to call a stored proc with an output parameter and return it back to the UI/Biz layer using HwyFwk?

Here is my query:

public class GetLog : AdvancedQuery<GetLogResult>
{
    public GetLog(int currentPage,int pageSize)
    {
        ContextQuery = db =>
        {
            var sql = string.Format("execute GetLog");
            SqlParameter outputIdParam = new SqlParameter("@ReturnValue", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            };
            var results = db.Database.SqlQuery<GetActivityLogResult>(sql,
                                                              new SqlParameter("@CurrentPage",currentPage),
                                                              new SqlParameter("@PageSize",currentPage),
                                                              outputIdParam
                                                              ).AsQueryable();

            //How can I return this and my recordset back to the UI/Biz layer?
            //TotalRows = (int)outputIdParam.Value;
            return results;
        };
    }
}
jigneshjdesai commented 8 years ago

I am also looking for the same thing. Were you able to resolve it or got any response back?

DevlinLiles commented 8 years ago

I'll take a look this week and put a branch out there for it.