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

Remove constructor injection from TagHelper creation. #1307

Merged
merged 1 commit into from
Oct 9, 2014

Conversation

NTaylorMullen
Copy link

@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_RemoveActivation branch from 55382b6 to 6af555a Compare October 9, 2014 04:17

try
{
tagHelper = Activator.CreateInstance<TTagHelper>();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to enforce TTagHelper to be new() because we want to throw a more informative error at runtime to point the user in the right direction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use new() constraint, you will get a compilation failure, not a runtime error.

@pranavkm
Copy link
Contributor

pranavkm commented Oct 9, 2014

:shipit:

- We now new up TagHelper's, requiring them to have parameterless constructors.
- Added test to validate throwing.
- Removed existing tests that expected the constructor injection behavior.

#1303
@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_RemoveActivation branch from 88ba8d0 to 6520ad2 Compare October 9, 2014 19:06
@NTaylorMullen NTaylorMullen merged commit 6520ad2 into TagHelpersFeature Oct 9, 2014
@NTaylorMullen NTaylorMullen deleted the TagHelpers_RemoveActivation branch October 9, 2014 19:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants