MightyOrm/Mighty

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

brgrz opened this issue · 1 comments

brgrz commented

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.

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.