@@ -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