Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing overloads in Dapper 1.50.2 #808

Closed
nvivo opened this issue Jun 21, 2017 · 2 comments
Closed

Missing overloads in Dapper 1.50.2 #808

nvivo opened this issue Jun 21, 2017 · 2 comments

Comments

@nvivo
Copy link

nvivo commented Jun 21, 2017

Using dapper 1.50.2, the following overloads seem to be missing:

QueryFirstAsync(string)
QueryFirstOrDefaultAsync(string)
QuerySingleAsync(string)
QuerySingleOrDefaultAsync(string)

As something like cn.QueryFirstAsync("select...") give the following error:
CS1503 Argument 2: cannot convert from 'string' to 'Dapper.CommandDefinition'

Edit: It seems the methods are there, but for some reason the compiler is resolving only these four methods to the wrong overload.

@nvivo
Copy link
Author

nvivo commented Jun 26, 2017

I have been looking into this, still have no clue on why it happens or how to fix it.

How to reproduce:

using Dapper;
using System.Data;

class Program
{
    static void Main(string[] args)
    {
        IDbConnection cn = null;
        cn.QueryFirstAsync("foo"); // cannot convert from 'string' to 'Dapper.CommandDefinition'
    }
}

Any ideas?

NickCraver added a commit that referenced this issue Aug 20, 2017
Add dynamic overloads for:
- QueryFirstAsync
- QueryFirstOrDefaultAsync
- QuerySingleAsync
- QuerySingleOrDefaultAsync

This may change a lot in 2.x, but many people asking for them now so here they are. Unit tests also fixed for QuerySingleOrDefaultAsync.

Note: this builds on the netstandard2 branch because of the xUnit changes to go with VS 2017 15.3.
@NickCraver
Copy link
Member

Fixed for the next release! Merging in and releasing likely this week or next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants