Commit Graph

665 Commits

Author SHA1 Message Date
Javier Calvarro Nelson 3ab0c3af29 [Issue #733] Attribute Routing: Implement Order
1. Added an Order property to IRouteTemplateProvider, ReflectedAttributeRouteModel,
   AttributeRouteInfo, AttributeRouteLinkGenerationEntry and AttributeRouteMatchingEntry.

2. Changed the implementation of AttributeRoute to take the order into account when routing
   incomming requests and generating links.

3. Ensured a stable ordering of route entries with the same order and precedence for route
   matching and link generation based on the template text.

4. Added tests to validate that the precedence gets respected in route matching and link generation.

5. Added tests to validate that the order gets respected in route matching and link generation.

6. Added tests to validate that the order gets respected over the precedence for route matching
   and link generation.

7. Added tests to validate that routes with the same order and precedence expose a stable ordering
   for route matching and link generation.
2014-08-14 11:21:05 -07:00
Javier Calvarro Nelson 63d9625536 [Issue #730] Attribute Routing: Flesh out attributes - Part 2
1. Unsealed the Http*Attributes so that they can be extended and customized.
2. Added the same constructors as HttpGet to the rest of the Http*Attributes.
3. Added unit tests to validate the implementations for the IActionHttpMethodProvider.
4. Added functional tests to cover extra attribute routing scenarios like a test for an
   action with an HttpDeleteAttribute on it and action with AcceptVerbsAttribute and an
   action with a custom HttpMergeAttribute implemented.
2014-08-14 11:21:03 -07:00
Javier Calvarro Nelson 21b1174d76 [Issue #730] Attribute Routing: Flesh out attributes - Part 1
1. Added a new AttributeRouteInfo class to store all the information for
   actions that are attribute routed.

2. Added a new ReflectedAttributeRouteModel class to store all the information
   related to attribute routes in the ReflectedApplicationModel.

3. Refactored ReflectedControllerModel and ReflectedActionModel to use ReflectedAttributeRouteModel
   instead of just the attribute route template.

4. Refactored ReflectedActionDescriptorProvider to use AttributeRouteInfo and ReflectedAttributeRouteModel
   instead of just the route template.

5. Added a CombineReflectedAttributeRouteModel method in ReflectedAttributeRouteModel that handles
   combining two ReflectedAttributeRouteModel instances.

6. Removed the AttributeRouteTemplate class and moved the methods for combining attribute routes to the
   ReflectedAttributeRouteModel class.

7. Added unit tests for ReflectedActionModel and  ReflectedControllerModel that
   cover the usage of AttributeRouteInfo.

8. Added unit tests for CombineReflectedAttributeRouteModel.
2014-08-14 11:21:01 -07:00
Pranav K 26f98b481a ViewComponents should render partial views
Fixes #960
2014-08-14 11:14:05 -07:00
dougbu 654d45812b Correct build break
- incorrect XML comment syntax for a few parameter references
2014-08-14 11:03:29 -07:00
Pranav K fb773f4814 ViewEngine shouldn't throw when it doesn't know about the extension
Fixes #984
2014-08-14 10:53:01 -07:00
dougbu 77066a3ade Improve XML comments in `HtmlHelper` and related classes and interfaces
- #847 line 1: copy XML comments from interfaces to extension methods
- lots of wording changes to be more consistent
 - core text split from PR #866, where @rynowak and I hashed out the words
 - to extent possible, reuse words between method descriptions

- add a few missing `<param/>` and `<typeparam/>` elements and fill in empty ones
- display more HTML elements as tags
- use `<c>true|false|null</c>` more often
- add `<remarks/>` describing behaviour of input helpers e.g. `CheckBox()`
- add `<remarks/>` explaining "renders"
- add `<remarks/>` containing example expression names

nits:
- "The expression" -> "An expression"
- make examples for `ObjectToDictionary()` and `AnonymousObjectToHtmlAttributes()` more consistent
- move `<typeparam/>` elements (that existed) after all `<param/>` elements
- explain "checked" attributes better, removing some duplicated words from the `RadioButton[For]()` descriptions
- correct `routeValues` description in `GenerateForm()` comments
2014-08-14 10:42:57 -07:00
Pranav K 439101d766 Adding doc comments for ModelBindingContext
Fixes #865
2014-08-13 17:02:49 -07:00
sornaks 9c4d7806a7 Introducing ByteArrayModelBinder.
-Checks for ModelType before processing.
-Ignores quotes in ByteArrayModelBinder.
-Unit,functional Tests.
-ModelStateError is set when Covert.FromBase64String(value) throws.
2014-08-13 15:15:52 -07:00
harshgMSFT 8d3d15fb4a Adding a functional test for anti forgery. 2014-08-13 15:00:00 -07:00
sornaks e6f4f0fec6 Introducing Activator for ViewComponents. 2014-08-13 14:22:43 -07:00
dougbu 75525ab525 Wrap a long URI 2014-08-13 11:08:42 -07:00
David Fowler 079fe5749d Added comment about the source of the Covert method 2014-08-13 09:30:01 -07:00
David Fowler 6f54d05105 Made razor compilation more robust
- Support other kinds of references when compiling razor views
- Cache application references since they can't change throughout the lifetime
of the running application
2014-08-12 21:44:21 -07:00
Pranav K edce771959 Fixing doc comment in RazorView 2014-08-12 10:50:53 -07:00
Pranav K 90b40832ff Modify RazorView to be instantiated via TypeActivator
Partial fix for #889
2014-08-12 10:37:00 -07:00
Pranav K 9e68a163fd Make RazorPage.IUrlHelper a non-public property
* This allows for injection of the property in cshtml files wthout running
in to compilation errors
* Make IUrlHelper a default injected service

Fixes #816
2014-08-12 10:12:23 -07:00
harshgMSFT 6ee034e64f ProducesAttribute +
Adding Functional Tests

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Formatters/OutputFormatter.cs
	src/Microsoft.AspNet.Mvc.Core/Resources.resx
	src/Microsoft.AspNet.Mvc.HeaderValueAbstractions/project.json
	test/Microsoft.AspNet.Mvc.FunctionalTests/project.json

Adding Resources + tests

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs
	src/Microsoft.AspNet.Mvc.Core/Resources.resx

Adding produces content Attribute

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj

Conflicts:
	src/Microsoft.AspNet.Mvc.Core/Microsoft.AspNet.Mvc.Core.kproj
	test/Microsoft.AspNet.Mvc.Core.Test/Microsoft.AspNet.Mvc.Core.Test.kproj
2014-08-11 17:52:55 -07:00
dougbu 099adda3d7 Test for XML documentation errors
- extend the "test" target in our build to use new k-xml-docs-test.shade command

Example output with one syntax error and one invalid reference:
```
info: Target xml-docs-test
warn: Invalid documentation syntax in src\Microsoft.AspNet.Mvc.Core\bin\debug\net45\Microsoft.AspNet.Mvc.Core.xml
warn:   3170: <!-- Badly formed XML comment ignored for member "T:Microsoft.AspNet.Mvc.Rendering.HtmlHelper" -->
warn:   3203: If the object is already an <see cref="!:IDictionaries&lt;string, object&gt;"/> instance, then it is
```
2014-08-11 16:23:18 -07:00
Pranav K 74bb8288b0 Making RoslynCompilationService a singleton.
* Minor code cleanup from previous compilation related PR.
2014-08-11 14:36:58 -07:00
Pranav K e96fbce95e Reverting changes to sln file made in 01f5fec210 2014-08-11 12:22:46 -07:00
harshgMSFT 927821a8ac Data Token support changes 2014-08-11 11:38:10 -07:00
Pranav K 758c0cadef Fixing unit test 2014-08-11 10:39:42 -07:00
Pranav K c12a4795ca Removing AdditionalInfo from CompilationResult since we can't always pass
it into exception thrown

All values in Exception.Data need to be serializable which is not true for
the diagnostics. Removing this property since we can't pass it through.
2014-08-11 10:25:12 -07:00
Pranav K 5e010597cd Propogate additional compilation data from RoslynCompilationService
* Update CompilationFailedException to include path of file being compiled
* Pass in path being compiled to Rolsyn.
* Adding doc comments for compilation pieces

Fixes #869
2014-08-08 18:22:13 -07:00
dougbu d95b85d057 Simplify some XML comment references
- follow VS fixup suggestion and change e.g. `<see cref="System.String"/>` -> `<see cref="string"/>`
2014-08-07 17:25:06 -07:00
dougbu 147b4416b5 Correct gaps in PR #934
- correct XML comment typo introduced in `HtmlHelper` in 56d66c090e (bad merge)
- fix missed `null` requirement for `@Html.RadioButtonFor()` and remove buried `null` check
- add back `Environment.Newline` to `@Html.TextArea()` (was dropped though comment wasn't)
2014-08-07 16:16:03 -07:00
Chris Ross cd3e1da219 Fix Challenge params order. 2014-08-07 16:03:34 -07:00
harshgMSFT d3407ff212 Routing related fixes for #55 2014-08-06 17:11:29 -07:00
dougbu 7ab93d34e4 Remove incorrect references to `HtmlHelper` class
- extension methods extend `IHtmlHelper`
2014-08-06 16:08:22 -07:00
dougbu 5bdf7955a0 Correct extension class names to match containing files
- #874 line 5
- `EditorExtensions` -> `HtmlHelperEditorExtensions`
- `SelectExtensions` -> `HtmlHelperSelectExtensions`
2014-08-06 16:08:20 -07:00
dougbu f4d53a0045 Prefer `IHtmlHelper` methods elsewhere in our code
- #847 line 7 sub-bullets
- don't call extension methods from our templates
 - partially addressed in PR #934 (for methods changed there)
- don't reference extension methods from XML comments
2014-08-06 16:08:17 -07:00
dougbu 4c5aa15f0b Call `IHtmlHelper` methods from extension methods
- don't call other extension methods
- #847 line 7
- remove extension methods that do nothing but pass through to the interface method
 - weren't exactly ambiguous (interface method wins) but were useless
2014-08-06 16:08:14 -07:00
dougbu 56d66c090e Make HTML helper `null` handling consistent
- #874 lines 3, 4, and 6
- correct `Value()` to treat a `null` expression name the same as `string.Empty`
- add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()`
- consistently pass `null` for default expression names to the helpers
 - for example, from extension methods
- add test cases using `null` for expression name

nits:
- correct summary XML comment for `HtmlHelper` class
- use named parameters and prefer interface (not extension) methods in changed calls
- use `string.Empty` instead of `""` in a few tests
2014-08-06 16:04:56 -07:00
Pranav K 4bf078269f Updating dev Nuget.config 2014-08-06 12:30:48 -07:00
Pranav K 4642d3968d Updating release Nuget.config 2014-08-05 15:50:05 -07:00
dougbu 8ab11bc073 Correct XML comment syntax
- fix problems at least with Roslyn compiler and VS IntelliSense or the Object Browser
 - `<see langref="keyword"/>` generates nothing
 - `<example>` at top level (outside `<summary>`) generates nothing
 - curly braces don't become angle brackets outside `<see cref="reference"/>` references
  - yeah, a point @yishaigalatzer asked about in a previous PR
- `<see href="reference"/>` is not valid
- correct some invalid use of angle brackets and remove useless empty elements
- correct unresolved XML comment references; generally, add namespace prefix

Symptoms for some of the above issues included
- generated XML comments such as `<!-- Badly formed XML comment ... -->`, usually indicating an unclosed element
- generated XML attributes such as `cref="!:..."`, indicating a broken reference
 - in a couple of cases we had `<typeparamref cref="TOption"/>`; attribute should be `"name"`

Few wording changes beyond
- `"opening </form> tag"` -> `"<form> start tag"`
- `"closing </form> tag"` -> `"</form> end tag"`

Also correct two typos in `HtmlHelper`

Will create a unit test to ensure XML syntax doesn't degrade going forward.  Separate PR.
- for now, check using `dir -r *.xml | sls '!'`
2014-08-05 14:24:48 -07:00
Pranav K eaee27756c Updating project.json to use frameworks token 2014-08-05 12:15:11 -07:00
Pranav K 5168808906 Introducing RazorTextWriter
RazorTextWriter represents the result of rendering a page as a sequence of
strings rather than a concatenated string. This avoids building up large
strings in memory.
2014-08-05 10:09:04 -07:00
dougbu dc58eb297d Remove unused `using`s from 3db0a80306 change
- see 3db0a80306
2014-08-04 18:10:50 -07:00
Pranav K 9d36a45f38 Updating tests using Moq to workaround Roslyn changes
https://roslyn.codeplex.com/workitem/246 affects usage of code with the
latest build of Roslyn with Moq v4.2. The workaround involves ensuring a
closure is created. Updating affected tests to make ToString() calls on
local variables to create these closures.
2014-08-04 17:13:19 -07:00
Ryan Nowak 383c6305e1 Fix for issue #349 2014-08-04 16:49:24 -07:00
dougbu 3db0a80306 Remove HTML helpers with `IDictionary<string, object>` parameters
- see line 2 of #874
- focus on `TextBox[For]()` and `ValidationSummary()`

related fixes included here:
- `TextArea[For]()` documentation incorrectly indicated their `htmlAttributes` parameters were dictionaries
- handle `htmlAttributes` parameters more consistently; create a dictionary only when necessary
2014-08-03 22:37:42 -07:00
dougbu c9b2323592 Move web site projects back where they belong
- solution corrupted in a recent checkin
2014-08-02 14:42:42 -07:00
dougbu d0d7c6aef8 Add `HtmlHelperDisplayTextTest` and `HtmlHelperValueExtensionsTest` classes 2014-08-01 21:06:28 -07:00
dougbu 126ee116cf Remove useless `.ToString()` calls in tests 2014-08-01 21:06:23 -07:00
dougbu 7845a8fbe1 `@Html.DisplayName()`, `.DisplayText()`, `.Id()`, `.Name()`, `.Value()` return `string`
- fixes #566 and part of #847
- allows compositions such as `@Html.Label("property", Html.Id("property"))`
  and `@Html.Raw(Html.DisplayText("property"))` (this one is not recommended)
- adjust XML comments to match
- add missing XML comments to `HtmlHelperValueExtensions`
- nit: `TInnerModel` -> `TModelItem`

- increase XML comment consistency for changed methods
 - generally make wording more consistent e.g. how we use words such as
   "returns"
 - use `<see langref="string|true|false|null"/>` more
2014-08-01 21:06:20 -07:00
Ben Brown 01f5fec210 Added Logging to Mvc 2014-08-01 15:33:47 -07:00
harshgMSFT 11d6c507f9 Stylecop fixes 2014-08-01 14:21:00 -07:00
harshgMSFT 19f3f78b3e Adding TextPlainFormatter to always handle returning strings as text\plain format.
Conflicts:
	src/Microsoft.AspNet.Mvc.Common/Encodings.cs
	src/Microsoft.AspNet.Mvc.Core/Formatters/JsonOutputFormatter.cs
	src/Microsoft.AspNet.Mvc/MvcOptionsSetup.cs
	test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ObjectContentResultTests.cs
	test/Microsoft.AspNet.Mvc.Test/MvcOptionSetupTest.cs
2014-08-01 13:47:23 -07:00