one step closer.
This commit is contained in:
parent
1a4bde89df
commit
48db853236
@ -23,7 +23,7 @@ namespace PoweredSoft.DynamicLinq.ConsoleApp
|
|||||||
var expressionParser = new ExpressionParser(typeof(Author), "Posts.Comments.CommentLikes");
|
var expressionParser = new ExpressionParser(typeof(Author), "Posts.Comments.CommentLikes");
|
||||||
expressionParser.Parse();
|
expressionParser.Parse();
|
||||||
|
|
||||||
var finalExpression = CreateSelectExpressionFromParsed(expressionParser, SelectCollectionHandling.Flatten, SelectNullHandling.LeaveAsIs);
|
var finalExpression = CreateSelectExpressionFromParsed(expressionParser, SelectCollectionHandling.Flatten, SelectNullHandling.New);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Expression CreateSelectExpressionFromParsed(ExpressionParser expressionParser,
|
public static Expression CreateSelectExpressionFromParsed(ExpressionParser expressionParser,
|
||||||
@ -32,15 +32,19 @@ namespace PoweredSoft.DynamicLinq.ConsoleApp
|
|||||||
{
|
{
|
||||||
Type nullHandlingRightType = null;
|
Type nullHandlingRightType = null;
|
||||||
Expression nullHandlingNullValue = null;
|
Expression nullHandlingNullValue = null;
|
||||||
|
|
||||||
/*
|
|
||||||
if (nullChecking != SelectNullHandling.LeaveAsIs)
|
if (nullChecking != SelectNullHandling.LeaveAsIs)
|
||||||
{
|
{
|
||||||
nullHandlingRightType = parts.Last().PartExpression.Type;
|
var withoutNullCheckResult = CreateSelectExpressionFromParsed(expressionParser, SelectCollectionHandling.Flatten, SelectNullHandling.LeaveAsIs);
|
||||||
|
if (QueryableHelpers.IsGenericEnumerable(withoutNullCheckResult.Type))
|
||||||
|
nullHandlingRightType = typeof(List<>).MakeGenericType(withoutNullCheckResult.Type.GenericTypeArguments.First());
|
||||||
|
else
|
||||||
|
nullHandlingRightType = withoutNullCheckResult.Type;
|
||||||
|
|
||||||
nullHandlingNullValue = nullChecking == SelectNullHandling.Default
|
nullHandlingNullValue = nullChecking == SelectNullHandling.Default
|
||||||
? Expression.Default(nullHandlingRightType) as Expression
|
? Expression.Default(nullHandlingRightType) as Expression
|
||||||
: Expression.New(nullHandlingRightType) as Expression;
|
: Expression.New(nullHandlingRightType) as Expression;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// reversed :)
|
// reversed :)
|
||||||
var reversedCopy = expressionParser.Groups.Select(t => t).ToList();
|
var reversedCopy = expressionParser.Groups.Select(t => t).ToList();
|
||||||
|
@ -122,6 +122,11 @@ namespace PoweredSoft.DynamicLinq.Helpers
|
|||||||
Groups.Add(group);
|
Groups.Add(group);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExpressionParameterGroup LastGroup()
|
||||||
|
{
|
||||||
|
return this.Groups.Last();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExpressionPathPart
|
public class ExpressionPathPart
|
||||||
|
Loading…
Reference in New Issue
Block a user