zompinc / efcore-extensions

Provides window (analytics) functions and binary functions for EF Core. Providers: SQL Server, SQLite, Postgres.
MIT License
60 stars 6 forks source link

I don't know if it's possible to protect against stupidity, but... #19

Closed redwyre closed 5 months ago

redwyre commented 5 months ago

I managed to spend an hour or so with a colleague trying to figure out why our queries were suddenly running client side when adding the RowNumber function, but the issues was just that we didn't call UseWindowFunctions to enable the SQL generation.

If you can add something to check or add to the error message that it might not be configured, that would protect against this 😅

virzak commented 5 months ago

@redwyre, thanks for pointing that out after you got over the hurdle.

The message was basically a standard EF Core message. It is now appended with One possible cause of this error is that '.UseWindowFunctions()' was not called on the 'DbContextOptionsBuilder' in 'OnConfiguring'.

https://dotnetfiddle.net/RLK21Q

Do you think this would make it clearer for a future user?

This is available in the latest beta 8.0.19-beta

redwyre commented 5 months ago

Perfect, thank you 😄