-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add copy helpers for TagHelperOutput from TagBuilder. #1322
Conversation
|
||
namespace Microsoft.AspNet.Mvc.TagHelpers | ||
{ | ||
internal class TagHelperOutputHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leave this public
but move it into Microsoft.AspNet.Mvc.TagHelpers.Internals
⌚ |
Addressed code review comments. Will wait for rebase to pick up Mvc.sln fix. My VS is in ruins 😢 |
@@ -0,0 +1,17 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to Mvc.NoFun.sln once the Microsoft.AspNet.Mvc.TagHelpers
project is there.
5ff3854
to
3b4fe50
Compare
89b19e2
to
42a508d
Compare
This change includes the basic properties that we're providing for compatability as well as some functional tests and unit tests that verify that ApiController can be a controller class.
Adds an options class, as well as a default options setup that will configure the default set of formatters. Currently most of what options needs to do is a placeholder, but it later do things like add ApplicationModelConventions, filters, formatters, model binders, etc. Those will be added in follow up items.
This change adds ApplicationModel conventions that can enable WebAPI action conventions (verb mapping) and WebAPI overloading. The conventions activate when a controller has a marker attribute. ApiController has this attribute, so any ported code will automatically opt-in. Also ported some old tests for action selection to our new functional test framework.
This change adds a .Request property to the ApiController class that can be used to access an HttpRequestMessage wrapping the HttpContext. The HttpRequestMessage is stored in an http feature to make it accessible to model binders and other infrastructure.
This change adds a ModelBinder that can bind an HttpRequestMessage to an action parameter. This builds on an earlier change to construct and store the request message in the HttpContext via an http feature.
Adds a formatter that can convert an HttpResponseMessage returned from an action into HttpContext.Response output.
Adds the set of CreateResponse/CreateErrorResponse extension methods that return an HttpResponseMessage. For the overloads that perform content negotiation they will access the collection of MediaTypeFormatters through the shim options. Note that CreateResponse and friends use the OLD formatters. Also, HttpError and CreateErrorResponse assume ErrorDetail == false. Using the shim you will not get detailed error messages unless you construct the HttpError instance yourself.
3b4fe50
to
b1918ba
Compare
attribute.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).ToArray(); | ||
|
||
// Since we're "pulling" the prefixed attribute values we need to remove the attributes that have the given | ||
// prefix from our output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits:
- "the attributes that have the given prefix" is (surprisingly) more confusing than "them"
- comma before "we need"
|
42a508d
to
11c1354
Compare
be24e23
to
c175091
Compare
please close this PR and open one based on TagHelpersFeature |
1) Expose the simplified relative path template by cleaning up constraints, optional and catch all tokens from the template. 2) Expose the parameters on the route template as API parameters. 3) Combine parameters from the route and the action descriptor when the parameter doesn't come from the body. #886 will refine this. 4) Expose optionality and constraints for path parameters. Open question: Should we explicitly expose IsCatchAll?
11c1354
to
ff2f78d
Compare
c175091
to
e0a0206
Compare
…pResponseMessageOutputFormatter
Going to hold off on rebasing onto |
…data to Enum parameter. Fix: Using TypeConverter solves this problem. -Issue #1123 - TypeConverterModelBinder cannot bind "byte" and "short". Fix: Modified code to use TypeConverter which can handle these scenarios. -Removing the GetConverterDelegate method and making the code similar to the WebApi.
…ing, PathString, etc. To build Urls. Added tests to describe the current behaviour with Unicode hosts.
- part of #1243 (kind-of) - mostly copied from `HtmlHelper` but refactored to - consistently take a `ViewContext` parameter and return a `TagBuilder` - provide `GenerateActionLink()` and `GenerateRouteLink()` - provide a separate `GenerateHiddenForCheckBox()`, allowing `GenerateCheckBox()` to return a `TagBuilder` - `GenerateForm()`'s `method` parameter is a `string`, not `FormMethod` nits: format document, consistent line wrapping, variable name changes, ...
…ple.Web - also fix a couple of minor issues in TagHelperSample.Web
- new Microsoft.AspNet.Mvc.TagHelpers.Test project - bit of test infrastructure -- `TestableHtmlGenerator` - short-curcuits validation attribute and AntiForgery additions - should help when testing all MVC tag helpers
- make a few more methods available as `internal static` in `DefaultHtmlGenerator` - remove `IHtmlGenerator.GenerateOption()`; now `internal static` nits: - add `IHtmlGenerator.IdAttributeDotReplacement` - move `DefaultHtmlGenerator.IdAttributeDotReplacement` after constructor - move `HtmlHelper.ActionLink()` below static methods - move newly-`internal` methods together in `DefaultHtmlGenerator` - correct placement of `DefaultHtmlGenerator.GetValidationAttributes()` comment
- Tested out Merge and MergeAttributes. #1319
e0a0206
to
199a8e2
Compare
Closing so I can reopen against TagHelpersFeature. |
Tag Helpers: Add TagHelperOutput extension methods to copy from TagBuilder #1319