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

InvalidOperationException: No primary key field(s) have been specified, when calling Paged() with empty orderBy #11

Open
brgrz opened this issue Aug 27, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@brgrz
Copy link

brgrz commented Aug 27, 2019

When calling Paged() with empty orderBy the following exception occurs:

InvalidOperationException: No primary key field(s) have been specified
Mighty.Keys.PrimaryKeyInfo.CheckGetPrimaryKeyColumns()

Maybe the exception thrown should be something more telling, I just spent couple of hours debugging what was going on with either the DB, connection string or mapping only to find out the orderBy paramater sent into Paged() was empty.

@brgrz brgrz changed the title InvalidOperationException: No primary key field(s) have been specified Mighty.Keys.PrimaryKeyInfo.CheckGetPrimaryKeyColumns() InvalidOperationException: No primary key field(s) have been specified Aug 27, 2019
@mikebeaton
Copy link
Member

mikebeaton commented Aug 27, 2019

Fair point! As I've been using Mighty myself, I've been updating exception messages to be more helpful where possible (changes not pushed to live yet, though). At first I thought I'd already come across this one myself, but looking around the code I don't think I have. I'll leave this open and add it to a (hopefully near) future update.

@mikebeaton mikebeaton changed the title InvalidOperationException: No primary key field(s) have been specified InvalidOperationException: No primary key field(s) have been specified, when calling Paged() with empty orderBy Oct 16, 2019
@mikebeaton mikebeaton self-assigned this Feb 20, 2020
@mikebeaton mikebeaton added the enhancement New feature or request label Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants