-
Notifications
You must be signed in to change notification settings - Fork 934
GH-1879 - Allow Coalesce and Conditional logic on entity properties #1880
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
Conversation
{ | ||
private readonly QueryModel _originalSubQueryModel; | ||
private int _depth = -1; | ||
private readonly IList<bool> _nominate = new List<bool>(); |
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.
Shoudn't this be a Stack<bool>
?
newTrue = BuildNewSubQuery(newTrue); | ||
Rewritten = true; | ||
} | ||
_nominate.Insert(_depth, false); |
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.
Isn't a RemoveAt(_depth)
lacking here? (So a Pop
, if converted to a stack.)
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Text; | ||
using System.Threading.Tasks; |
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.
From all the System
usings, only using System.Linq.Expressions;
is actually needed.
where T : Expression | ||
where TVisitor : ConditionalQueryReferenceExpressionRewriter<T, TVisitor>, new() | ||
{ | ||
protected System.Type QueryType { get; private set; } |
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.
It has no usage in current subclasses. Shouldn't it be turned into a private field?
return Expression.Condition( | ||
Expression.NotEqual(node.Left, Expression.Constant(null, node.Left.Type)), | ||
this.Visit(node.Left), | ||
this.Visit(node.Right)); |
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.
Using this
, when no conflict mandates it, is not the usual practice of NHibernate code base. this
qualifiers should not be used wherever possible in new or modified code.
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Text; | ||
using System.Threading.Tasks; |
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.
From all the System
usings, only System.Collections.Generic
and System.Linq.Expressions
are actually needed.
@@ -27,6 +27,9 @@ public class QueryModelVisitor : NhQueryModelVisitorBase, INhQueryModelVisitor | |||
public static ExpressionToHqlTranslationResults GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, bool root, | |||
NhLinqExpressionReturnType? rootReturnType) | |||
{ | |||
// Expand conditionals in subquery FROM clauses into multiple subqueries | |||
SubQueryConditionalExpander.ReWrite(queryModel); | |||
|
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.
Some undue trailing whitespaces are left on line 32. @hazzik, shouldn't we add in .editorconfig trim_trailing_whitespace = true
? Of course it may at first generate some noise on edited files by removing all trailing whitespaces.
This comment has been minimized.
This comment has been minimized.
…operties and collections (LINQ)
I added additional tests for Method and Extension Method access. I think I got all the other clean up as well. |
…tity properties and collections (LINQ) Add missing async generation
…tity properties and collections (LINQ) Do additional minor cleanup
This comment has been minimized.
This comment has been minimized.
…tity properties and collections (LINQ) Use a stack instead of a list with a pointer to "depth"
I added some additional checks and logic to handle nested conditionals in subqueries |
See issue #1879 for details