Commit Graph

793 Commits

Author SHA1 Message Date
Ryan Nowak 1563700feb Fix for #1539 - We're not going to do anything special when request
services aren't enabled

This is just removing the TODO.
2014-11-20 11:14:01 -08:00
N. Taylor Mullen 9c4d5dcf5c React to aspnet/Razor#214 mvchook changes. 2014-11-20 10:45:37 -08:00
NTaylorMullen 1cf6607e75 React to aspnet/Razor#214 changes.
- TagHelperAttributeDescriptors changed to be lighterweight and not depend on PropertyInfo, had to modify our use of them to work with the new contract.
2014-11-20 10:27:33 -08:00
Doug Bunting 6c4b1398b8 Address small `InputTagHelper` bug discovered while testing
- Type attribute value was "Type", not "type", when determined from template hints

nit: remove useless condition
2014-11-19 22:36:41 -08:00
Doug Bunting 1b28e19114 MVC tag helpers should not override tag name in Razor source
- #1523
- remove `TagHelperOutput.Merge()` extension method entirely
- test tag name preservation with all MVC tag helpers
 - `<input/>` tag helper generation of a checkbox wasn't previously tested

nits:
- fix argument order in a couple of `Assert.Equal()` calls
- remove use of "original tag name"
2014-11-19 22:35:31 -08:00
Ryan Nowak ed8ba5ae9c Fix for #1194 - Error using [HttpPost] and [Route] together
This change enables some compatibility scenarios with MVC 5 by expanding
the set of legal ways to configure attribute routing. Most promiently, the
following example is now legal:

[HttpPost]
[Route("Products")]
public void MyAction() { }

This will define a single action that accepts POST on route "Products".

See the comments in #1194 for a more detailed description of what changed
with more examples.
2014-11-19 15:52:20 -08:00
Ajay Bhargav Baaskaran e21f157095 changed contract.assert to debug.assert 2014-11-19 15:35:28 -08:00
ianhong f470fa6d74 Merge branch 'actionmodel1495c' into dev 2014-11-18 16:59:01 -08:00
Pranav K a322588af6 Reacting to DataProtectionServices being removed from hosting services 2014-11-18 15:49:12 -08:00
ianhong 59b7352e8e Update per comment 2014-11-18 15:35:40 -08:00
ianhong 7b58d569eb ReadOnly attributes for Action, Controller, and Parameter 2014-11-18 15:35:39 -08:00
Ryan Nowak 38b3b61485 update due to breaking changes in routing 2014-11-18 12:37:47 -08:00
Ryan Nowak 5fd453f07d Revert "Fix for MVC #1539 - Deal with the case where request services are not set"
This reverts commit d9a3c265ea.

This was the wrong commit, did not intent to merge this.
2014-11-17 18:33:56 -08:00
Ryan Nowak d9a3c265ea Fix for MVC #1539 - Deal with the case where request services are not set
Rather than throwing here, this does what routing does. If request
services aren't set, we just create our own scope.

This will NOT create an extra scope if request services are already set.
2014-11-17 17:30:41 -08:00
ianhong 57d234bd7b Removing a <inheritdoc> comment that I forgot from the previous push. 2014-11-14 15:22:36 -08:00
Pranav K 052ad3e95f RenderSection \ RenderSectionAsync does not work in sections
Fixes #1509
2014-11-14 12:17:25 -08:00
ianhong dd1500dcfb Updated a comment and sort usings 2014-11-13 11:28:13 -08:00
ianhong 245d1dffda Updating the summary comment for IRazorViewFactory and its tests per comments 2014-11-13 11:28:12 -08:00
ianhong 0720177243 Updating per comments 2014-11-13 11:28:12 -08:00
ianhong e9c7a34cfc Introducing RazorViewFactory for RazorView 2014-11-13 11:28:11 -08:00
Doug Bunting 7e8870cb9f Per PR discussion
- clean up "the the" in XML comments
- simplify refactoring VS did when I renamed `GetHtmlHelperForViewData()`
 - fix existing issue in `HtmlHelperCheckboxTest.CheckBoxReplacesUnderscoresInHtmlAttributesWithDashes()`
   (was using a `HtmlHelper<ViewDataDictionary<TestModel>>`)
2014-11-12 21:56:11 -08:00
Doug Bunting 6313a9682e Address PR comments in product code
- XML comment improvements
2014-11-12 21:55:55 -08:00
Doug Bunting 22fafe298c Add `BeginRouteForm()` HTML helper
- refactor `DefaultHtmlGenerator.GenerateForm()` to support new method

nits:
- correct XML comments
- add a few more code comments
2014-11-12 21:55:40 -08:00
kanchanm 47d0afbe38 Fixing xml comment typo 2014-11-12 16:25:01 -08:00
kanchanm 4598505652 Fix to special case Dispose method to be treated as non-action 2014-11-12 14:52:19 -08:00
Ryan Nowak e9d8c845d6 Create a new routedata for each 'router' for MVC
This is the MVC companion to https://github.com/aspnet/Routing/pull/122

As routing flows, routes replace the route data and mutate a copy. This
allows users to make changes that dirty the data without affecting
undesired state changes.

We also add the 'next' router for diagnostic purposes.
2014-11-12 11:10:21 -08:00
Kiran Challa 17e4dd2bf6 [Fixes #1429] Content negotiation does a case-sensitive matching of media type's parameter values 2014-11-11 10:15:51 -08:00
Doug Bunting 2d32420f01 Add `<option/>` tag helper
- #1423
2014-11-07 14:11:12 -08:00
Doug Bunting 30f25fec99 Provide selected values to `<option/>` tag helpers
- value may remain in the `FormContext` beyond `</select>` end tag but will
  be cleaned up at the `</form>` end tag of the containing `<form/>` element
 - `SelectTagHelper` called prior to helpers for contained `<option/>`s and
   not again later
- adjust mock setups to handle new `GenerateSelect()` call
- add assertions for expected `FormContext.FormData` entry

nit: mention #1468 in a test comment
2014-11-07 14:11:07 -08:00
Doug Bunting 3d84b528e5 Extend `IHtmlGenerator.GenerateSelect()` to make selected values available
nit: use Linq methods, not query syntax in `DefaultHtmlGenerator`
2014-11-07 14:10:26 -08:00
Harsh Gupta 6b2f331e8d Adding support for excluding types for validation, based on type names for body bound models. 2014-11-06 11:00:50 -08:00
SonjaKhan 27e0323a8a renaming TraceType to LogLevel 2014-11-06 09:24:02 -08:00
Doug Bunting f7ef604b86 Regenerate .kproj files
- does not seem to have a negative impact
- e.g. sample web projects run / debug fine
2014-11-04 22:41:53 -08:00
Doug Bunting 90e41b905a Add `ModelMetadata.HtmlEncode` property
- use new `ModelMetadata.HtmlEncode` property in HTML helpers
 - specifically in default HTML display and editor object templates (e.g.
   `@Html.DisplayFor()`) when value is non-`null` and the template is invoked
   with template depth greater than 1
- similar to MVC 5.2 commit [2b12791aee4f](https://aspnetwebstack.codeplex.com/SourceControl/changeset/2b12791aee4ffc56c7928b623bb45ee425813021)

nits:
- remove dupe `null` check in `DefaultDisplayTemplates.ObjectTemplate()`
- move backing fields initialized with constants together in `ModelMetadata`
2014-11-03 12:23:33 -08:00
Pranav K d5515bfbb6 Adding arg null or empty checks to RazorViewEngine.FindView &
FindPartialView
2014-11-02 18:33:56 -08:00
Pranav K 74da350086 Remove enableInstrumentation from CompilerCache and IMvcRazorHost 2014-11-02 18:15:39 -08:00
N. Taylor Mullen 4720381d78 Change the IRazorCompilationService's DI lifetime.
- Modified the MvcServices registration of IRazorCompilationService to be transient to ensure the IMvcRazorHost does not maintain state.
2014-10-31 22:41:07 -07:00
Ryan Nowak 30884d8d26 Removing types marked as obsolete 2014-10-31 18:54:18 -07:00
Ryan Nowak b8645eeb31 Follow up to JsonResult changes
Changing the WebAPI shim to use the new and improved JsonResult.
2014-10-31 18:33:15 -07:00
Ryan Nowak 105c99cbf2 Fix #1370 - Always use the provided formatter in JsonResult
The change here is to always use the provided formatter, instead of using
it as a fallback. This is much less surprising for users.

There are some other subtle changes here and cleanup of the tests, as well
as documentation additions.

The primary change is that we still want to run 'select' on a formatter
even if it's the only one. This allows us to choose a content type based
on the accept header.

In the case of a user-provided formatter, we'll try to honor the best
possible combination of Accept and specified ContentTypes (specified
ContentTypes win if there's a conflict). If nothing works, we'll still run
the user-provided formatter and let it decide what to do.

In the case of the default (formatters from options) we do conneg, and if
there's a conflict, fall back to a global (from services)
JsonOutputFormatter - we let it decide what to do.

This should leave us with a defined and tested behavior for all cases.
2014-10-31 14:30:31 -07:00
sornaks d178200795 Adding functional tests for Filters. 2014-10-31 08:36:31 -07:00
Pranav K 3aaeebd9c5 Revert "Revert "Added a functional test for view precompilation""
This reverts commit 6b2ab32885.
2014-10-30 14:38:44 -07:00
Doug Bunting 97aaa7049e Correct code checking for `ViewDataDictionary.ModelMetadata==null`
- `null` checks can generally be removed but in one case needed to
  special-case metadata for `object`

nit: remove duplicate empty `string` check in
`ExpressionMetadataProvider.FromStringExpression()`
2014-10-29 19:18:31 -07:00
Doug Bunting e73655229c Correct some `ViewDataDictionary` constructor calls
- ensure correct `ViewData.ModelState` value in a `RazorPage` instance
- let view components inherit `ViewData.Model` from surrounding context
- do not create an isolated `ViewDataDictionary<TModel>` in one HTML helper
 - allows previous `ViewDataDictionary<TModel>` constructor to be `internal`
  - also add comments for that constructor
- change two `ViewDataDictionary` copy constructor calls to avoid uselessly
  copying `Model` and related information from source
2014-10-29 19:18:20 -07:00
Doug Bunting a3b07dacdb Rework `ViewDataDictionary` constructors to ensure `ModelMetadata` is never `null`
- `ViewDataDictionary<TModel>` constructors now pass `typeof(TModel)` to base
  `protected` constructors
 - move type compatibility checks into base `ViewDataDictionary`
 - remove `ViewDataDictionary<TModel>.ModelMetadata` override
- don't retrieve `ModelMetadata` twice in a single constructor invocation
- remove newly-unused `protected` properties and use `private` fields in copy
  constructors

Address longstanding problems found (see #1466)
- avoid reusing `ModelMetadata` after `Model` value changes
 - reset `ModelMetadata` backing field in `Model` setter
 - `Model` and `ModelMetadata.Model` could previously get out of sync
- carry `ModelMetadata` forward from an outer scope only if `Model` matches
 - previously two scopes could have different `Model` values but share their
   `ModelMetadata` (and `ModelMetadata.Model`)
 - related to previous item but didn't require `Model` setting; switching
   to a property of the same type as containing `Model` was enough
- avoid NRE if `ViewDataDictionary<int>.Model` is read before it's written
 - problem affected all non-`Nullable` value types
- `ViewDataDictionary.ModelMetadata` setter should throw if value is `null`

nits:
- add and reword doc and code comments
 - `ViewDataDictionary<TModel>` constructors should only inherit base's
   parameter descriptions; have more information in the derived class
- make a few `ViewDataDictionary` properties get-only
- clean up `using` statements in `ViewDataDictionary<TModel>`
- make two constructors `internal`
2014-10-29 19:03:58 -07:00
Ryan Nowak 83187945d1 Fix for #1052 - ViewComponents should support fully qualified names
This change adds the concept of a full-name to viewcomponents. View
components can be invoked using either the short name or long name. If the
provided string contains a '.' character, then it will be compared against
full names, otherwise it will be matched against short names only.

The short name is used for view lookups.

If the name is explicitly set via ViewComponent attribute, then the full
name is the name provided. The short name is the portion of the name after
the last '.'. If there are no dots, then the short name and full name are
the same.

If the name is not set explicitly, then it is inferred from the Type and
namespace name. The short name is the Type name, minus the 'ViewComponent'
suffix (if present). The full name is the namespace of the defining class,
plus the short name.
2014-10-29 17:34:01 -07:00
Kirthi Krishnamraju dc1aaf0664 Merge branch 'release' into dev 2014-10-29 13:42:56 -07:00
Kirthi Krishnamraju 028a2359a4 Added description in project.json for all projects 2014-10-29 13:40:31 -07:00
Pranav K 07ff6eb3be Update to JSON.Net 6.0.6
Fixes #1473
2014-10-29 10:18:55 -07:00
jacalvar 6b2ab32885 Revert "Added a functional test for view precompilation"
This reverts commit 310feeb826.
2014-10-28 19:14:50 -07:00