-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
var formatters = _bindingContext.Value.InputFormatters; | ||
var requestServices = bindingContext.OperationBindingContext.HttpContext.RequestServices; | ||
|
||
var formatterSelector = requestServices.GetRequiredService<IInputFormatterSelector>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started a thread - #2330 - to discuss if we could change the contract for formatters. It might allow us to get away from doing GetRequiredService
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ugly to get all these 4 services as part of execution. Is this the general pattern for anything that needs scoped/instance services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully addressing the layering might solve this. We had a chat with @loudej and he thought this was ok. However I think there's an ongoing discussion \ work item about visiting the usage of GetRequiredServices
in our framework, so this should get covered as part of it.
This is a really gigantic PR, is it possible to break up at this point? |
@rynowak, let me give it a try. I can start by un-deleting the files to start with - perhaps it might make the diffs less daunting. |
2092aea
to
29ac06d
Compare
29ac06d
to
4374a06
Compare
Ok - Sending it out in parts - this contains most of the code changes without the file deletions. Think this should be manageable. |
[NotNull] IValueProviderFactoryProvider valueProviderFactoryProvider, | ||
[NotNull] IReadOnlyList<IModelBinder> modelBinders, | ||
[NotNull] IReadOnlyList<IModelValidatorProvider> modelValidatorProviders, | ||
[NotNull] IReadOnlyList<IValueProviderFactory> valueProviderFactories, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonus RyanPoints for using IReadOnlyList
😍
Fixes #2266
Fixes #2269