-
-
Notifications
You must be signed in to change notification settings - Fork 158
Filtering replacement #1287
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
Comments
That's an interesting experiment. How do you intend to address the mismatch in expression shapes? We chose function-style syntax to avoid the complexities of operator precedence. Even in the latest version of EF Core, operator precedence bugs are still being fixed. I'm glad we never had to be concerned with that. Personally, I would want to refrain from executing regular expressions against a potentially large database table. I don't think using indexes is possible, but I'm not sure. What do you find confusing or cumbersome about the expression shape? It's pretty straightforward for filters: The visitor pattern is pretty standard for traversing or rewriting trees. It provides type safety and extensibility. EF Core and Roslyn are both full of them. Having data-only nodes would make that a lot harder. The transforms you're using are conceptually similar to our visitors. Note you can override The conversion from We can't introduce interfaces for the However, you can add extra nodes that derive from I've created a PR that opens up the parsers and LINQ builders at #1286. |
I completely agree and in our case we'd definitely be setting up a full-text index for this feature. That said, my preference for framework design is to treat people like adults. Give them the flexibility they need and a solemn warning that they should avoid using this freedom to shoot themselves in the foot.
Personally /I/ don't find anything about them cumbersome or confusing -- but my front-end team dislikes the prefix notation and has requested a more flexible strategy.
So my complaint about visitors as they're traditionally implemented is that they need to declare public members for every possible type of node. My preference is to approach them as a map-of-strategies see GrandUnifiedVisitorBase. That said I do realize that the existing query-building system is /very/ tied into how this is all currently structured and changes would involve breaking stuff marked as I think the more reasonable ask here is work to make it possible for me to inject my strategy through the DI container. I think this fits better with my original comment seeing this work as an optional extra package too. I'm not sure exactly what that will be yet but I'm pretty sure it will be fairly simple. At first glance I'll need to make some classes public / not sealed and add a factory or two. I'll rebase my branch on this PR and work through that. |
@jeffreyabecker to answer your question:
Great question. Yes, it is intentional. Only the top-level data source is For example, the picture below demonstrates that the |
Closing due to inactivity. Please let me know if it needs to stay open. |
My end goal was to provide my front-end team with the following:
filter=name like $nameMatch&filter[$nameMatch]=%example%
I've got an Antlr4 grammar & parser generated for this language. In a perfect world I'd like to submit a PR for this either in the core or as a separate package. I'm struggling to identify exactly what I'd need to that as I find the current model confusing / cumbersome. Specifically I'm running into trouble:
It would be nice if:
JsonApiDotNetCore.Queries.Expressions.QueryExpression.Visit
could be purely representational / not have the Visit function.QueryExpressions
toSystem.Linq.Expressions
could be encapsulated separatelyOriginally posted by @jeffreyabecker in #1277 (comment)
The text was updated successfully, but these errors were encountered: