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

GetAll<T> only supports an entity with a single [Key] or [ExplicitKey] property. [Key] Count: 0, [ExplicitKey] Count: 2 #93

Open
gandarez opened this issue Nov 21, 2019 · 6 comments

Comments

@gandarez
Copy link

[Table("MyTable")]
public class TableEntity
{
    [ExplicitKey]
    public string Name { get; set; }
    [ExplicitKey]
    public Guid Id { get; set; }
}

The error happens when calling

return await GetAllAsync<MyTable>();
@winhoals
Copy link

me too

@NickCraver NickCraver transferred this issue from DapperLib/Dapper May 8, 2021
@jakehockey10
Copy link

I'm running into this as well. I have a table with a composite key. Hope this gets some attention soon.

@SuperJMN
Copy link

I've got this problem, too

@sk0va
Copy link

sk0va commented Mar 24, 2022

Same issue

@asilvestrosipos
Copy link

Same problem

@corsantic
Copy link

using Dapper.Contrib.Extensions;

[Table("MyTable")]
public class TableEntity
{
    [Key]
    public Guid Id { get; set; }
 
    public string Name { get; set; }
}

Check your library of the [ExplicitKey] and try adding [Key] to Guid only.

Library of the key must be Dapper.Contrib.Extensions;

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

7 participants