-
Notifications
You must be signed in to change notification settings - Fork 14
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
✨ [FEATURE] Pagination / filtering re-implementation #21
Comments
If you'd like to review my code as I am working on it (currently it is complete), here is the branch on my github repo: https://github.com/jeffward01/EasyRepository.EFCore/tree/explicit-enums-pagination I am going to do my best to not introduce any additional packages. There is a chance that the Microsoft.DI framework will not be sufficient, I will need to do more investigation on this to confirm. If it is not sufficient, I will need to add either:
|
Question for you:
Breaking Change:There will be a breaking change where the user will no longer have a dependency on The user will need to perform (2) actions to fix the broken changes
Old Version: public void ConfigureServices(IServiceCollection services)
{
// Old Version
services.ApplyEasyRepository<TDbContext>()
// Overload...
services.ApplyEasyRepository<TDbContext>(ServiceLifetime.Scoped);
} New Version: public void ConfigureServices(IServiceCollection services)
{
// New Version - AutoFilterer || Example of Overload is below:
services.ApplyEasyRepository<TDbContext>().ApplyEasyRepositoryAutoFilterer();
services.ApplyEasyRepository<TDbContext>(ServiceLifetime.Scoped).ApplyEasyRepositoryAutoFilterer();
// New Version - Gridify || Example of Overload is below:
services.ApplyEasyRepository<TDbContext>().ApplyEasyRepositoryGridify();
services.ApplyEasyRepository<TDbContext>(ServiceLifetime.Scoped).ApplyEasyRepositoryGridify();
// New Version - Sieve || Example of Overload is below:
services.ApplyEasyRepository<TDbContext>().ApplyEasyRepositorySieve();
services.ApplyEasyRepository<TDbContext>(ServiceLifetime.Scoped).ApplyEasyRepositorySieve();
}
// Note: Currently, I plan to throw an exception if => 2 or more of these filters / paginators are registered.
// Possible Feature Request:
// Make more flexible and add configuration so the user can register (2) or more of these filters Note: Currently, I plan to throw an exception if => 2 or more of these filters / paginators are registered.
|
Sorry for so many comments, I wanted to make all my requests separate comments for reference ease QuestionI will also update the Wiki. How should we do this?A.) You grant me access to the Wiki, then I update it I think Note: |
It's a nice long topic. I can understand the response object you want for your projects. On the link you shared, a reference was made to the pagination response object that the clients should see. AutoFilterer does not have to provide this response object. You can edit the Response object according to your needs. I understand your requests on this matter, but this is not a feature that we will support right away. You can fork and make any changes you want for your own projects. I will keep this request and we will evaluate and develop it together with my team. Thanks for your contribution. |
In spirit of this, what about if I make the changes as outlined, with the difference of:
// Note: I'm not proposing this literally, this is just a sketch to convey what I mean
services.ApplyEasyRepository<TDbContext>(configOptions => {
configOptions.Pagination = SomeEnum.AutoFilterer
}) Something like this?
Thank you, I will do so. If it's alright with you, I'd rather keep this discussion open and make the changes for my own projects in-line with your vision and scope, I would massively prefer to make the changes with your vision and scope, rather than with an un-guided vision and scope. If the changes are un-guided, in this sense, the likely-hood of a simple later pull-request being incorporated into the library is much lower as it would require a re-write. I would prefer to avoid re-writes and build it with your vision and scope the first time. On that note, do you think you can outline some hard requirements for this, and I can get a Scope of Work / Development Plans created that we can discuss? Thank you again for your input and I appreciate your opinion ❤️ I agree with you - I dislike breaking changes and its best to avoid them |
Ah, I just saw this bit about the team - Fair enough! Let me know if I could be of further assistance by tagging me in an issue. I will stand-down on the Pagination and Filter topic and wait for you and your team |
We have created a plan regarding this issue. AutoFilterer dependency will be moved to a library named EasyRepository.EFCore.AutoFilterer by applying correct abstraction techniques in future versions. While creating this library, a document will be created for the integration of new libraries and developers will be able to add new libraries by reading this document. AutoFilterer is a great library developed by @enisn that generates automatic queries. |
Summary
I was working with Pagination, and I found the way it was currently implemented to be restricting. I found (1) bug, and (1) major improvement that could be made.
For my own projects, this is a reason why I would not use this library (no offense). Many people need pagination to return:
Standard Pagination Response Object:
https://stackoverflow.com/questions/12168624/pagination-response-payload-from-a-restful-api
Something like this^^
The key is to get this back as a JSON response object:
or at the minimum return this as a JSON response object:
Current Pagination Bugs
What is currently implemented (This is the bug):
Proposed Changes
I propose (2) things:
EasyRepository.EfCore.AutoFilterer
-- This will allow us to implement new filter implementation using Gridify, Sieve and others, instead of currently we are 'married' to AutoFiltererThis is the improvement I mentioned in the beginning of my post.
TFilter
object instead of theTEntity
Object. This will be a 'breaking change' as it involves changing what currently implemented methods return.Paged
orFiltered
to the method. I prefer the suffix ofPaged
as mostly allFiltered
use-cases for UI's will also bePaged
.Closing Statement
To be honest, I need these methods in my own implementation, so I will get started on this. If you reject this proposal I 100% understand, and I will keep the code to myself.
If you think this is helpful and useful, I will add my code and create a pull-request so that our branches can be 'in-sync'.
What are your thoughts? Please make any changes or suggestions as you see fit.
The text was updated successfully, but these errors were encountered: