Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blazor] Take cascading parameter attribute type into account when supplying cascading values #48554
[Blazor] Take cascading parameter attribute type into account when supplying cascading values #48554
Changes from 6 commits
a9b17cd
4c294a4
10601dd
fa7d9c5
640ec5f
1868b54
09bae24
9b31d05
05d5bcb
4e562dc
40f9289
3474f0b
688aaba
32bc52d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We need to think about what happens when you have
[SupplyParameterFromQuery]
and[SupplyParameterFromFrom]
attribute. There are some cases that might be "incompatible", but there are other cases where we might want both attributes to apply. For example, if we do[SupplyParameterFromPrerenderedState]
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.
Hm, true. I wonder if it would be fine to modify this code slightly to add a
ReflectedCascadingParameterInfo
for each attribute on the parameter property. Maybe we could also add something like anOrder
property toICascadingParameterAttribute
so that, for example, if[SupplyParameterFromQuery]
and[SupplyParameterFromForm]
are both present, we prioritize supplying a value from a form when possible, but fall back to supplying a parameter from the query if form data is not available.Is this something you think should be addressed by this PR?
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.
Great points to raise. It would definitely be consistent with other parts of the framework if we had an
Order
property.I don't think you should feel required to implement that in this PR but if there's broad agreement about the direction, it would be good to file an issue summarizing the design then we can hopefully get on and implement that soon.
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.
BTW we likely end up with a fairly clear, straightforwards design if:
CascadingParameterAttribute
is unsealedOrder
propertyAllowMultiple = true
Then we can cheaply have form/query subclasses in a different assembly, and the core doesn't need to know or care about anything but the base class.
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.
CascadingParameterAttribute
I'd rather not open up the ability for third-parties to create their own definitions of Cascading values by extending/overriding CascadingParameterAttribute.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.
I tried to address that in #48554 (comment). Can you give more details about what you're concerned about?
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.
I like this, but wouldn't
CascadingModelBinder
andCascadingQueryValueProvider
still need to know what attribute type was used so that, in the case of only one attribute being present, they don't supply values for each other (or forCascadingValue
) by accident? Or would we be okay with, for example, a parameter annotated with[CascadingValue]
receiving values from the query or a form request?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.
I would expect
CascadingModelBinder
andCascadingQueryValueProvider
to be in layers where they are able to know about the correspondingCascadingParameterAttribute
subclass and hence can do the same type check that you already have.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.
I would have expected this to be done directly within
CascadingModelBinder
and not as a separate component.CascadingModelBinder
in my view, is responsible for all the binding operations related to[SupplyParameterFromXXX]