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

Tag Helpers: Add ModelExpression code generation #1300

Closed

Conversation

NTaylorMullen
Copy link

  • Sealed the ModelExpression.
  • We use the stringified version of the ModelExpression type name to detect ModelExpression properties on TagHelpers. This is so the MvcRazorHost can work in tooling and in runtime.
  • Created a GeneratedTagHelperAttributeContext to represent the specific stringified versions of the ModelExpression assets.
  • Created an MvcTagHelperAttributeValueCodeRenderer to modify rendering of ModelExpression properties.

Added tests to validate attribute value rendering

/cc @dougbu

#line hidden

#pragma warning disable 1998
public override async Task ExecuteAsync()
Copy link
Author

Choose a reason for hiding this comment

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

Being empty is expected behavior for now. TagHelpers don't support DesignTime intellisense pieces so we don't generate anything for them during DesignTime.

That will be done in this issue: #1252.

@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_ModelExpressionCodeGen branch from b3ae381 to 0f6c981 Compare October 8, 2014 22:37
@NTaylorMullen NTaylorMullen force-pushed the TagHelpersFeature branch 2 times, most recently from d948242 to b68fae9 Compare October 9, 2014 19:52
public string ModelExpressionTypeName { get; set; }

/// <summary>
/// String representation of a method to create model expression types.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • "String representation" -> "Name" here and above (!!)
  • just "model expressions" or <c>ModelExpression</c>s since there's just one such type and this method creates instances in any case (not types)
  • nit: "the method"

@dougbu
Copy link
Contributor

dougbu commented Oct 9, 2014

please rebase TagHelpers_ModelExpressionCodeGen branch and force-push it here. no longer possible to see your changes

@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_ModelExpressionCodeGen branch from 0f6c981 to e9544bb Compare October 9, 2014 22:59
@NTaylorMullen
Copy link
Author

Addressed code review comments and rebased.


namespace Microsoft.AspNet.Mvc.Rendering
{
// This is here to mimic the real ModelExpression type defined in Microsoft.AspNet.Mvc.Core.
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@dougbu
Copy link
Contributor

dougbu commented Oct 10, 2014

:shipit:

NTaylorMullen added 2 commits October 9, 2014 22:47
- Sealed the ModelExpression.
- We use the stringified version of the ModelExpression type name to detect ModelExpression properties on TagHelpers. This is so the MvcRazorHost can work in tooling and in runtime.
- Created a GeneratedTagHelperAttributeContext to represent the specific stringified versions of the ModelExpression assets.
- Created an MvcTagHelperAttributeValueCodeRenderer to modify rendering of ModelExpression properties.

#1241
- Exposed internals from Mvc.Razor.Host to Mvc.Razor.Test so it can use the MvcRazorHost override that takes the IFileSystem.
- Added end-to-end code generation tests for TagHelpers with ModelExpression properties.

#1241
@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_ModelExpressionCodeGen branch from e9544bb to 75a77e2 Compare October 10, 2014 05:56
@NTaylorMullen
Copy link
Author

2005c3c
75a77e2

@NTaylorMullen NTaylorMullen deleted the TagHelpers_ModelExpressionCodeGen branch October 15, 2014 22:50
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.

4 participants