Skip to content

Commit 119f2a9

Browse files
author
Dilshod Komilov
committed
remove flag
1 parent 11ad626 commit 119f2a9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/Microsoft.AspNet.OData.Shared/Query/Expressions/SelectExpandBinder.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,8 @@ internal Expression ProjectElement(Expression source, SelectExpandClause selectE
293293
LinqParameterContainer.Parameterize(typeof(string), _modelID) :
294294
Expression.Constant(_modelID);
295295
wrapperTypeMemberAssignments.Add(Expression.Bind(wrapperProperty, wrapperPropertyValueExpression));
296-
bool instanseOfWrapperClassWasSet = false;
297296
if (IsSelectAll(selectExpandClause))
298297
{
299-
instanseOfWrapperClassWasSet = true;
300298
// Initialize property 'Instance' on the wrapper class
301299
wrapperProperty = wrapperType.GetProperty("Instance");
302300
wrapperTypeMemberAssignments.Add(Expression.Bind(wrapperProperty, source));
@@ -351,10 +349,7 @@ internal Expression ProjectElement(Expression source, SelectExpandClause selectE
351349
Type wrapperGenericType = GetWrapperGenericType(isInstancePropertySet, isTypeNamePropertySet, isContainerPropertySet);
352350
wrapperType = wrapperGenericType.MakeGenericType(elementType);
353351

354-
if (instanseOfWrapperClassWasSet)
355-
return Expression.MemberInit(Expression.New(wrapperType), wrapperTypeMemberAssignments);
356-
ConstructorInfo constructorWithInstanse = wrapperType.GetConstructors().Single(c => c.GetParameters().Length == 1);
357-
return Expression.MemberInit(Expression.New(constructorWithInstanse, source), wrapperTypeMemberAssignments);
352+
return Expression.MemberInit(Expression.New(wrapperType), wrapperTypeMemberAssignments);
358353
}
359354

360355
/// <summary>

0 commit comments

Comments
 (0)