-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Consider support for source generators #53
Comments
At the time, my opinion was that since this is built on top of an ORM, any performance gains from using source generation will be negligible compared to the database query that will take place as part of calling this. But you make a good point about supporting AOT. And this library is about performance too after all. Also, generating bespoke methods to build the keyset might greatly decrease allocations as right now we box to One problem would be generating the code to obtain the column values of a reference, due to loose typing this can be any This will likely require a new major version as I suspect some breaking changes, but that's fine. As for pagination tokens. The way this library works now, it's up to the consumer how a reference is obtained. Usually, an id is sent between the front and the back. But I could see some code generation giving more flexibility to what you're allowed to provide instead of this reference. i.e. Instead of needing an In any case, this will be a major rewrite but would love to do this eventually. |
Yes, this is exactly what I'd love to see, as the lookup introduces an extra db call and is the source of a potential bug when that record has been removed in between page navigations.
Presumably the reference could be of the generic type corresponding to the query or the record of the keyset type. For other arbitrary types, you could require the caller maps their reference object to the keyset record type. Or, since the DTO pattern is common here, you could potentially name additional types during specification of the sort which would generate typed overloads that perform that mapping for you. |
Agreed. Mapping is less ergonomic ( |
There is a fair amount of runtime expression manipulation handled by this library that might benefit from using a source generator at compile time. As I'm integrating this into a keyset paginated API, some benefits I could see from a source generated version:
It may also be reasonable to generate both IQueryable and IEnumerable versions using source generation to resolve #12, or determine if EFCore Async methods are available for IQueryable to resolve #32.
The text was updated successfully, but these errors were encountered: