Skip to content

Commit

Permalink
Remove the null check, fix issue #1755
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Sep 14, 2020
1 parent 4d55fe1 commit 1314963
Showing 1 changed file with 1 addition and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,6 @@ internal void BuildSelectedProperty(Expression source, IEdmStructuredType struct
return;
}

Expression nullCheck = GetNullCheckExpression(structuralProperty, propertyValue, subSelectExpandClause);

Expression countExpression = CreateTotalCountExpression(propertyValue, pathSelectItem.CountOption);

// be noted: the property structured type could be null, because the property maybe not a complex property.
Expand All @@ -808,11 +806,7 @@ internal void BuildSelectedProperty(Expression source, IEdmStructuredType struct
NamedPropertyExpression propertyExpression = new NamedPropertyExpression(propertyName, propertyValue);
if (subSelectExpandClause != null)
{
if (!structuralProperty.Type.IsCollection())
{
propertyExpression.NullCheck = nullCheck;
}
else if (_settings.PageSize.HasValue)
if (structuralProperty.Type.IsCollection() && _settings.PageSize.HasValue)
{
propertyExpression.PageSize = _settings.PageSize.Value;
}
Expand Down Expand Up @@ -904,23 +898,6 @@ private Expression AddOrderByQueryForSource(Expression source, OrderByClause ord
return source;
}

private static Expression GetNullCheckExpression(IEdmStructuralProperty propertyToInclude, Expression propertyValue,
SelectExpandClause projection)
{
if (projection == null || propertyToInclude.Type.IsCollection())
{
return null;
}

if (IsSelectAll(projection) && propertyToInclude.Type.IsComplex())
{
// for Collections (Primitive, Enum, Complex collection), that's check above.
return Expression.Equal(propertyValue, Expression.Constant(null));
}

return null;
}

private Expression GetNullCheckExpression(IEdmNavigationProperty propertyToExpand, Expression propertyValue,
SelectExpandClause projection)
{
Expand Down

0 comments on commit 1314963

Please sign in to comment.