C# remove SQL from method and use stored procedure & Dapper
<p>I'm trying to convert a method to use a stored procedure with Dapper. But I'm quite confused with what's going on with <code>var result =...</code></p>

<pre><code>public Task&lt;TUser&gt; FindByIdAsync(Guid userId)
{
    var sql = @"SELECT *
                FROM IdentityUser
                WHERE UserId = @USERID";

    using (var connection = new SqlConnection(_connection))
    {
        var result = connection.Query&lt;TUser, IdentityProfile, TUser&gt;(sql, (user, profile) =&gt; { user.Profile = profile;
                             return user; }, 
                          new { userId }, splitOn: "UserId").SingleOrDefault();

        return Task.FromResult(result);
     }
}
</code></pre>

<p>Here is what I have:</p>

<pre><code>public Task&lt;TUser&gt; FindByIdAsync(Guid userId)
{
    using (var connection = new SqlConnection(_connection))
    {
        var param = new DynamicParameters();
        param.Add("@UserId", userId);

        return Task.FromResult(connection.Query("IdentityGetUserById", param, commandType: CommandType.StoredProcedure).SingleOrDefault());
    }
}
</code></pre>