File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
src/Mvc/Mvc.Abstractions/src/ModelBinding Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -178,19 +178,16 @@ public Type? BinderType
178
178
}
179
179
180
180
// Keyed services
181
- if ( attributes . Any ( a => typeof ( IFromServiceMetadata ) . IsAssignableFrom ( a . GetType ( ) ) ) )
181
+ if ( attributes . OfType < FromKeyedServicesAttribute > ( ) . FirstOrDefault ( ) is { } fromKeyedServicesAttribute )
182
182
{
183
- if ( attributes . OfType < FromKeyedServicesAttribute > ( ) . FirstOrDefault ( ) is not null )
183
+ if ( bindingInfo . BindingSource != null )
184
184
{
185
185
throw new NotSupportedException (
186
- $ "The { nameof ( FromKeyedServicesAttribute ) } is not supported on parameters that are also annotated with { nameof ( IFromServiceMetadata ) } .") ;
186
+ $ "The { nameof ( FromKeyedServicesAttribute ) } is not supported on parameters that are also annotated with { nameof ( IBindingSourceMetadata ) } .") ;
187
187
}
188
- }
189
- if ( attributes . OfType < FromKeyedServicesAttribute > ( ) . FirstOrDefault ( ) is { } fromKeydServicesAttribute )
190
- {
191
188
isBindingInfoPresent = true ;
192
189
bindingInfo . BindingSource = BindingSource . Services ;
193
- bindingInfo . ServiceKey = fromKeydServicesAttribute . Key ;
190
+ bindingInfo . ServiceKey = fromKeyedServicesAttribute . Key ;
194
191
}
195
192
196
193
return isBindingInfoPresent ? bindingInfo : null ;
You can’t perform that action at this time.
0 commit comments