Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Tag Helpers: Modify TagHelper creation to activate ViewContext properties instead of inheriting from an interface. #1258

@NTaylorMullen

Description

@NTaylorMullen

Right now TagHelpers can retrieve the RazorPage's ViewContext by implementing ICanHasViewContext, after talks with @yishaigalatzer we've decided that we don't want this interface to be publicly facing and that we can provide the ViewContext to the TagHelper in a better format.

New way:

class DivTagHelper : TagHelper
{
    [Activate]
    public ViewContext ViewContext { get; set; }
}

Note: Once aspnet/Razor/issues/182 is implemented we can decide if we want to make [Activate] take on the same behavior or if we want to make users be explicit on the [NotBound] attribute.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions