Dapper / SQL Server-从包含Exec的存储过程中获取输出

时间:2019-03-28 10:52:48

标签: dapper

我试图从存储过程中获取数据

CREATE PROCEDURE [Asset].[GetAssetForGrid]
    @Skip INT,
    @Take INT,
    @TotalRows INT OUTPUT
AS
BEGIN
    EXEC GetPaged @DataSource = 'Asset.vAssetNest'
                         ,@Skip = @Skip
                         ,@Take = @Take
                         ,@TotalRows = @TotalRows
END

C#代码:

var param = new DynamicParameters();
param.Add("@Skip", request.Skip, direction: ParameterDirection.Input);
param.Add("@Take", request.Take, direction: ParameterDirection.Input);
param.Add("@TotalRows", DbType.Int32, direction: ParameterDirection.Output);

var resultDb = _dbContext.DbConnection.Query<TEntity>("Asset.GetAssetForGrid", param, commandType: CommandType.StoredProcedure);

但是我无法获取任何数据。如果我全部替换为

SELECT * 
FROM  Asset.vAssetNest

然后我得到了结果。

我如何从Exec GetPaged获得结果?

0 个答案:

没有答案