File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -122,20 +122,19 @@ public static Expression PrepareExpressionFromAnonymous<TSource>(Expression sour
122122 throw new ArgumentNullException ( nameof ( expression ) ) ;
123123
124124 // Anonymous initializations are not implemented as member initialization but as plain constructor call, potentially wrapped in a Convert expression
125- var newExpression = UnwrapConvert ( expression . Body ) as NewExpression ??
125+ var newExpression = UnwrapConvertExpression ( expression . Body ) as NewExpression ??
126126 throw new ArgumentException ( "The expression must be an anonymous initialization, e.g. x => new { Name = x.Name, Age = x.Age + 5 }" ) ;
127127
128128 var instance = new DmlExpressionRewriter ( expression . Parameters ) ;
129129 instance . AddSettersFromAnonymousConstructor ( newExpression , "" ) ;
130130 return PrepareExpression < TSource > ( sourceExpression , instance . _assignments ) ;
131131 }
132132
133- private static Expression UnwrapConvert ( Expression expression )
133+ private static Expression UnwrapConvertExpression ( Expression expression )
134134 {
135- if ( expression is UnaryExpression unaryExpression &&
136- unaryExpression . NodeType is ExpressionType . Convert or ExpressionType . ConvertChecked )
135+ if ( expression is UnaryExpression ue && ue . NodeType == ExpressionType . Convert )
137136 {
138- return unaryExpression . Operand ;
137+ return ue . Operand ;
139138 }
140139
141140 return expression ;
You can’t perform that action at this time.
0 commit comments