Skip to content

[Blazor] Introduce a public abstraction for property injection #63451

@javiercn

Description

@javiercn

We can't have property injection be taken care by the DefaultComponentActivator as that would be a breaking change.

MVC defines a set of public APIs for activating properties in different contexts (tag helpers, view components, controller, razor pages).

In some cases, property activation is not exposed (like for Razor Pages) and only the page activator is available (single entry extension point for creating the component).

Unfortunately, we can't take that route as it will break existing custom implementations of the activator that now would also be responsible for performing property injection.

For that reason, I believe we need to introduce a separate IComponentPropertyActivator to specifically support handling property activation.

The activator should return a delegate so that it can close over any state it needs to for performing the activation and receive the component instance as a parameter. We need to think if we also want to pass in a context object for future proofing ourselves in case we want to provide additional data in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions