Why does Dapper QueryAsync<T> behave differently from Query<T> with sproc return values?

前提是你 提交于 2019-12-04 17:27:08

Currently Dapper doesn't support for Async methods that no perform a SELECT statement.
There is a open issue about that in Github:
https://github.com/StackExchange/Dapper/issues/591

What you do for now is something like:

ALTER PROCEDURE dbo.ConditionalGet
    @ID INT,
    @Output INT OUTPUT
AS
BEGIN

    -- this is a silly made up condition just to test the issue
    IF @ID % 2 = 1
    BEGIN
        SET @Output = -1
    END
    ELSE BEGIN
        SET @Output = 0
    END

    SELECT *
    FROM MyTable
    WHERE ID = @ID
END
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!