-
Notifications
You must be signed in to change notification settings - Fork 157
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
LINQ Provider Rewrite #2518
base: main
Are you sure you want to change the base?
LINQ Provider Rewrite #2518
Conversation
ce0cad0
to
4a261fe
Compare
…orted sorting methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments!
{ | ||
Visit(node.Arguments[0]); | ||
var whereClause = new WhereClauseVisitor(_metadata); | ||
var lambda = (LambdaExpression)StripQuotes(node.Arguments[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at this comment
|
||
namespace Realms | ||
{ | ||
internal class SortClauseVisitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a base class, something called "ClauseVisitor", that also has the strip method
throw new NotSupportedException($"The operator '{binaryExpression.NodeType}' is not supported"); | ||
} | ||
|
||
if (binaryExpression.Left is MemberExpression binaryLeftMemberExpression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a lot of repeated code here, try to avoid this. There is no difference between left and right here
{ | ||
if (node.Expression != null && node.Expression.NodeType == ExpressionType.Parameter) | ||
{ | ||
ComparisonNode comparisonNode = new EqualityNode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean statements with no equality sign (e.g .Where(p => !p.IsInteresting))
|
||
private static string GetKind(object valueType) | ||
{ | ||
if (valueType == typeof(float)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this with a switch statement? Also, does valueType need to be object? Can we be more specific with the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some research on this and it does not seem like there is a good way to do this, we can discuss this later
# Conflicts: # wrappers/realm-core
This is still a draft, but I've cleaned it out a little, so it should be readable enough. |
Description
I'm experimenting with ways to rewrite the way the LINQ provider works to a more object-oriented structure. This is just a rough sketch so this is not planned to be merged and might not even be close to the end product.
The idea is to have it as objects so that it can be easily transferred to a JSON structure if that is the case. E.g a query like:
var query = _realm.All<Person>().Where(p => p.Score == 5 && p.FirstName == "Test" && p.LastName == "Testersson");
should give the ability to create a JSON structure like: