Components that accept bind-Something can request SomethingExpression#213
Merged
SteveSandersonMS merged 3 commits intomasterfrom Feb 18, 2019
Merged
Conversation
rynowak
reviewed
Feb 15, 2019
src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/ComponentBindLoweringPass.cs
Show resolved
Hide resolved
rynowak
reviewed
Feb 15, 2019
src/Razor/src/Microsoft.CodeAnalysis.Razor/BindTagHelperDescriptorProvider.cs
Show resolved
Hide resolved
rynowak
reviewed
Feb 15, 2019
src/Razor/src/Microsoft.CodeAnalysis.Razor/BindTagHelperDescriptorProvider.cs
Show resolved
Hide resolved
rynowak
reviewed
Feb 15, 2019
src/Razor/src/Microsoft.AspNetCore.Razor.Language/Components/ComponentBindLoweringPass.cs
Show resolved
Hide resolved
rynowak
reviewed
Feb 15, 2019
...Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ComponentCodeGenerationTestBase.cs
Show resolved
Hide resolved
rynowak
reviewed
Feb 15, 2019
...Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ComponentCodeGenerationTestBase.cs
Show resolved
Hide resolved
rynowak
approved these changes
Feb 15, 2019
Member
rynowak
left a comment
There was a problem hiding this comment.
This looks really great!
@ajaybhargavb it would be super cool if you would look at this as well - if only to come up to speed on what this does.
Member
|
@NTaylorMullen FYI in case you are interesting. Dopeness is happening. |
JunTaoLuo
pushed a commit
to dotnet/aspnetcore
that referenced
this pull request
May 17, 2020
…dotnet/razor#213) * In binding to components, automatically supply FooExpression when requested * Fix tests * CR feedback \n\nCommit migrated from dotnet/razor@ca9de74
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is needed for the forms and validation enhancements in Components for Preview 3. It extends the pattern around binding to component properties with a new optional "*Expression" parameter, e.g.:
It's optional, so if the component doesn't declare
*Expression, then there's no change to the generated code versus what we had before.If the component does declare
*Expression(where*is something our existing rules match for binding based on the presence of*Changed), then when a consumer uses the binding, e.g.:... then it expands to be equivalent to:
This makes it possible for
MyEditorto read any metadata it wants about the thing you're binding to (e.g., validation annotations). What we actually use it for in the new built-in forms/validation system is uniquely identifying the bound field within theEditContext, so for exampleMyEditorcould highlight different states based on whether that field is currently tracked as modified/invalid/etc.Note: This is only for binding to components. There's no equivalent when binding to plain elements, since plain elements have no way of declaring that they want
*Expression(and no reason why they should, since they couldn't do anything with it).