Commit Graph

894 Commits

Author SHA1 Message Date
damianedwards 6490b113d8 Make LinkTagHelper JS down-level browser safe:
- #2088
2015-02-27 10:20:29 -08:00
Wei Wang 64ddbe0160 React to runtime perf changes in functional tests 2015-02-27 02:53:46 -08:00
Pranav K ed3f5118e3 Reacting to NullLoggerFactory removal 2015-02-26 17:52:50 -08:00
Pranav K 73f44889f2 ViewLocationExpanderContext should have a flag that indicates if the
lookup is for a full or partial view

Fixes #1212
2015-02-26 16:41:54 -08:00
Levi B b821b706b7 React to DataProtection rename 2015-02-25 17:31:02 -08:00
Ajay Bhargav Baaskaran 9f9dcbe6ec Additional functional tests for ElementalValueProvider 2015-02-25 10:22:43 -08:00
damianedwards e282d2a861 Ensure results of GlobbingUrlBuilder are sorted:
- #2062
2015-02-24 15:07:36 -08:00
Ajay Bhargav Baaskaran dc49a2c194 Added HttpNotFoundObjectResult and added relevant tests 2015-02-24 11:57:48 -08:00
Kiran Challa 5bb69e495e [Fixes #1184] Formatting issues in requests should not cause a 500 response 2015-02-24 10:39:11 -08:00
Kiran Challa f737083c94 Added JsonContractResolver to validate value type properties 2015-02-24 06:34:35 -08:00
Kiran Challa c276ddaa39 Added support for validation of Required attributes in case of XmlDataContractSerializerInputFormatter 2015-02-23 23:15:48 -08:00
damianedwards eef8884d0f LinkTagHelper & ScriptTagHelper now log view path:
- #1949
2015-02-23 21:51:45 -08:00
Ryan Nowak 9d5364cf9b Removing ModelMetadata.Model 2015-02-23 19:56:59 -08:00
Yishai Galatzer ed8e5716ea Remove INestedProviderXXX
React to aspnet/DependencyInjection#179
2015-02-23 15:18:39 -08:00
Doug Bunting 3dbdf3b2d6 Avoid exception in `MvcTagHelper` JavaScript
- `blank` is undefined so `blank.wooptido` threw
2015-02-23 14:26:28 -08:00
Kirthi Krishnamraju f6e701b2b2 Reverting #1837 and add non-generic overloads for TryUpdateModel 2015-02-23 10:02:51 -08:00
N. Taylor Mullen 1cc9be5df7 React to aspnet/Razor#238.
- Updated tests to create TagHelperContext correctly.
2015-02-22 20:29:25 -08:00
N. Taylor Mullen df4b92b1c1 Update MVC projects to utilize Common repo classes.
- Had to add extra dependencies to work around aspnet/XRE#1237.
- Updated src and test projects.
2015-02-22 18:23:28 -08:00
ianhong 4bb85eeaeb React to the selfclosing support in TagHelpers 2015-02-20 21:11:02 -08:00
Mugdha Kulkarni 4f0ba26c79 Adding the test cases for generating lower case URLs 2015-02-20 15:50:58 -08:00
Doug Bunting 43fc844524 Correct `grunt-bower-task` operation
- jQuery and jQuery-validation files were not being copied
- update to match more-recent VS templates

nit: simplify wwwroot/lib directory tree slightly
2015-02-20 12:19:23 -08:00
Pranav K e797b0af51 Disable functional tests in CoreCLR until System.Runtime.Dynamic issue is sorted out 2015-02-20 08:36:16 -08:00
Pranav K 57f5b19f25 * Move precompiled assemblies into a resource in the primary assembly.
* Emit the primary assembly if a tag helper requires it.
* Make TagHelperSample.Web use precompilation.

Fixes #1693
2015-02-19 17:50:54 -08:00
Luke Waters d9e2581c9a responding to interface break 2015-02-19 14:46:57 -08:00
Hao Kung 12541f7bba React to hosting change 2015-02-19 13:54:50 -08:00
Ajay Bhargav Baaskaran 9fcf31fa43 Activate ViewDataDictionary in DefaultTagHelperActivator 2015-02-19 13:21:06 -08:00
Ajay Bhargav Baaskaran d236d4ffde Added CanReadType to InputFormatter 2015-02-19 13:06:36 -08:00
Yishai Galatzer b12c4c5ef8 Cleanup services
Explicitly register nestedprovider managers
Make IActionSelector singleton
2015-02-19 11:14:09 -08:00
Harsh Gupta cf80721994 Fixing Build break due to Readme change 2015-02-19 10:56:45 -08:00
Harsh Gupta e0f7c1b810 Fixing Readme 2015-02-19 10:20:16 -08:00
Praburaj 1f98918f1f PR feedback to StatusCode filter. 2015-02-19 09:44:13 -08:00
Harsh Gupta 85b6382c69 Fix for #563 - FromForm, FromQuery and FromValue allow providing a Name which is used as a prefix. Also the name is used for reporting model state errors. 2015-02-18 16:48:12 -08:00
Pranav K 1cb170ce02 Add delay after _GlobalImport is deleted to allow file system watcher to react 2015-02-18 11:36:51 -08:00
Pranav K 4ac3acca22 Wait for precompiled file to change. 2015-02-18 11:23:57 -08:00
Pranav K eb7b0d6ae3 * Introduce _GlobalImports to inherit directives.
* Remove inheritance from _ViewStarts

Fixes #825
2015-02-18 10:02:37 -08:00
Doug Bunting 8eb63271b5 Make HTML helper parameter names consistent
- #944
- name `string` expression name and `Expression<Func<TModel, TResult>>`
  parameters "expression"
 - single special case is `GenerateIdFromName(string fullName)` since every
   other expression name is relative to the current
   `ViewData,TemplateInfo.HtmlFieldPrefix` value
 - applied from `IHtmlHelper` and `IHtmlGenerator` on up
- name `IHtmlHelper` and `IHtmlHelper<TModel>` parameters "htmlHelper"
- rename `TProperty` and `TValue` type parameters to `TResult`

nits:
- clean up abbreviated names in `CachedExpressionCompiler`
- change `ObjectToDictionary()`'s parameter name to `value`
- use `nameof` more to make renaming (and refactoring) easier in the future
- rewrap parameters and arguments to avoid long lines and orphans
2015-02-17 17:53:53 -08:00
Harsh Gupta f19c2e493d Merging Model Validation for body and non body validation.
This also fixes #1503.

Currently all model binders except mutable object binder are independent of validation code. The mutable object binder which needs to do some validation ( for scenarios involving [BindRequired] and [BindNever]).
We would be going with an approach where required validaiton happens in input formatters and model binders.
This is needed as validation for value types can best be done at creation time.

Followup PRs:
Introduce support for skipping validation (and not binding) for a particular property/type etc.
2015-02-17 11:50:39 -08:00
Levi B cf36a601c6 React to HttpRequest.IsSecure being renamed 2015-02-17 11:15:56 -08:00
Kiran Challa 3dc3d280d5 Fixed XmlAssert and added tests 2015-02-16 19:11:02 -08:00
damianedwards 6e845f0171 Add globbing support to the LinkTagHelper:
- #1581
2015-02-16 18:29:59 -08:00
Yishai Galatzer bcbbc58515 Api cleanup (remove List and Dictionary in favor of IList and IDictionary)
from the public surface copy header values on registration.

Make a copy of the mediatypeheader value in FormatterMappings so it's
really immutable.
2015-02-16 18:19:55 -08:00
Ryan Nowak d2aa55893d Functional tests for #302
This feature allows routing to generate a link when the action that is
being linked-to does not yet exist. See the PR in routing for the actual
implementation changes. This PR just has a simple functional test for the
scenario.
2015-02-16 17:59:31 -08:00
Stephen Halter 5de210f527 Fix for #1416 - Remove all uses of ITypeActivator and use the static method instead
- ITypeActivator is being removed
- Where an ITypeActivator was used before, use the static ActivatorUtilities
2015-02-16 16:02:39 -08:00
Hao Kung 94ef6cf8fa React to Authorize changes 2015-02-16 15:40:57 -08:00
Ajay Bhargav Baaskaran 3d30fd653e added Link method to IUrlHelper 2015-02-16 13:38:12 -08:00
N. Taylor Mullen 48a1cbb0e5 Fixed build break.
- IScopedInstance now implements IDisposable.
2015-02-16 13:08:10 -08:00
Pranav K 5e69d90076 * Modify DefaultControllerTypeProvider to look at the object graph to
determine if any ancestor has the "Controller" suffix.

* Introduce NonControllerAttribute to opt out of Controller detection.

Fixes #1274
2015-02-15 22:11:37 -08:00
Praburaj 3fc61eeac9 Introducing SkipStatusCodePagesAttribute attribute to disable StatusCodepages 2015-02-13 16:03:59 -08:00
Doug Bunting 0549769fd0 Set `ModelMetadata.TemplateHint` based on data annotations
- add `CachedDataAnnotationsMetadataAttributes.UIHint`
- set `ModelMetadata.TemplateHint` using `UIHintAttribute` or `HiddenInputAttribute`
- add doc comments for `TemplateHint`-related properties and methods
- add unit tests and use these attributes in functional tests

nits:
- cache and seal `CachedModelMetadata.IsCollectionType`
- correct doc comments for `ModelMetadata.RealModelType`
- add doc comments for `IsCollectionType`-related properties and methods
- add doc comments for `IsComplexType`-related properties and methods
- move `CachedModelMetadata.IsComplexType` right below `IsCollectionType`
 - same for related fields and methods
2015-02-13 15:28:45 -08:00
Doug Bunting 451db6fb16 React to aspnet/Razor#164: Camel-case tag helper directives 2015-02-13 12:07:21 -08:00
Ajay Bhargav Baaskaran 088bb18eed Added support for binding FormCollection
- Added FormCollectionModelBinder
 - Added relevant unit and functional tests
2015-02-13 11:14:50 -08:00
Pranav K a33e83f363 Adding IView.Path and ViewContext.ExecutingPagePath
Fixes #1940
2015-02-13 06:12:15 -08:00
Doug Bunting 3ced6016a1 Deep copy user's select list before making changes
- #524
- add tests of `DropDownList` and `ListBox` HTML helpers
- extend tests of `<select/>` tag helper
- add scenario to a functional test

New `HtmlHelperSelectTest` does not cover everything. In future (see #453):
- use non-`null` `optionLabel` and `htmlAttributes` arguments
- confirm value sources and their priorities
- mock an `IHtmlGenerator` and confirm how it is called
- mock an `IHtmlHelper` and confirm how extension methods call that
2015-02-12 20:56:53 -08:00
Pranav K 2169ba0c8f Reacting to ANIs going away 2015-02-12 14:52:17 -08:00
Doug Bunting ca65b1b6ed Correct recent checkins
- correct typo in 3303286288
 - really seal `CachedModelMetadata.Properties`
- make a couple of test methods `public` (!!)
- add Microsoft.AspNet.PageExecutionInstrumentation to Mvc.sln
- remove `<RootNamespace/>`, `<ProjectExtensions/>`, etc. from .kproj files
2015-02-12 08:53:17 -08:00
Pranav K f89c716dba Fixing build break 2015-02-11 17:54:04 -08:00
Ajay Bhargav Baaskaran 13e1c9d5e1 added InputFormatter base type 2015-02-11 16:48:56 -08:00
Pranav K e1e43e1e8c ControllerActivator should be able to use controllers registered as
services

* Added WithControllersFromServiceProvider that replaces the default
  controller activator with a service based one.
* Move activation to DefaultControllerFactory
* Modify [Activate] behavior so that it no longer activates services. Use
  [FromService] attribute to hydrate services

Fixes #1707
2015-02-11 16:41:59 -08:00
Ryan Nowak 7cb6c1065c Fix for #1913 - Improve attribute route link generation for areas
Attribute route link generation will now have a slight preference for
entries that can use ambient values (vs ignoring an ambient value). This
means that areas will be more 'sticky' with regard to link generation
without the need to specify a better Order.
2015-02-11 15:59:48 -08:00
Ryan Nowak 1721d90065 Fixes for changes in routing
Routing now requires the RouteOptions in the service provider.
2015-02-11 15:58:47 -08:00
Doug Bunting 7e166295ba Simplify `<select/>` tag helper `multiple` attribute handling
- #1516
- `allowMultiple == true` when model has a collection type
 - ignore any `multiple` attribute in Razor source when generating element
- simplify tests too: fewer error cases

Note Razor author could allow browser user to submit values model binding
will likely ignore: Could mix a `multiple` attribute with a non-collection
`asp-for` expression.
2015-02-10 19:01:30 -08:00
Yishai Galatzer dd3f67c93f Update dictionary initializer in ScriptTagHelperTest to C#6 2015-02-10 18:12:20 -08:00
Ryan Nowak b4d1eec87a Makes attribute routing respond to AD updates
This change makes the attribute route capable of responding to updates in
the action descriptor collection.

The change moves the actual route implementation to InnerAttributeRoute.
AttributeRoute now wraps an InnerAttributeRoute - when processing a route,
AttributeRoute will now check with action descriptor collection if its
InnerAttributeRoute is still 'current' and rebuild it if necessary.
2015-02-10 16:01:22 -08:00
Mugdha Kulkarni 09b0aa5182 fixing a build break due to change in the error message in Routing 2015-02-10 14:46:40 -08:00
Pranav K 70ce04ff21 Results of parsing _ViewStart files should be cached
Fixes #1016
2015-02-10 13:48:33 -08:00
sornaks d2c3985cd6 Issue #1445 - Cleanup on MvcOptions.ApplicationModelConventions. 2015-02-10 13:17:19 -08:00
Kiran Challa f474f7116a Temporarily fix build break related to XmlSerailizer tests failing in Core CLR. 2015-02-10 12:41:48 -08:00
Pranav K 8ed522de64 Revert "Temporarily skip MvcSampleTests scenario to workaround System.Dynamic.Runtime issue"
This reverts commit b3c38bc573.
2015-02-10 08:32:46 -08:00
Doug Bunting f93fca1077 PR comments
- change `AdditionalValues` type to `IDictionary<object, object>`
- copy `ModelMetadata.AdditionalValues` in `AssociatedMetadataProvider` sub-classes

nits:
- add XML comments
- correct indentation in `CachedModelMetadata`
2015-02-09 16:24:28 -08:00
Doug Bunting 3303286288 Add `ModelMetadata.AdditionalValues` property bag
- #1758
- provide the property bag in `ModelMetadata`; seal it in `CachedModelMetadata`
- add unit tests
- include use of `AdditionalValues` in model binding functional test

nits:
- expose `AdditionalValues` as an `IDictionary` though MVC 5 uses `Dictionary`
- seal `ModelMetadata.Properties` collection as well
- cover a few properties previously missed in `CachedDataAnnotationsModelMetadataTest`
- correct two `ModelMetadataTest` method names
2015-02-09 15:59:34 -08:00
Pranav K b3c38bc573 Temporarily skip MvcSampleTests scenario to workaround System.Dynamic.Runtime issue 2015-02-09 15:19:14 -08:00
Pranav K 6ef5518f8a Remove IRazorFileProviderCache and rely on file expiration triggers to
file change expiry.

Fixes #1969
2015-02-09 15:08:26 -08:00
Kiran Challa 4ecbe8c709 [Fixes #1065] Need a way to specify "just type" with produces 2015-02-09 10:46:24 -08:00
Anthony Sneed 2c21c7c9c7 [Resolves Issue #1787] Added InstanceOf, InstanceOfOrDefault, InstancesOf extension methods to IEnumerable<IOptionDescriptor<object>>.
Added RemoveTypesOf extension method to OutputFormatterDescriptor, ModelBinderDescriptor, ValueProviderFactoryDescriptor.
2015-02-09 10:46:01 +01:00
Youngjune Hong 57c04835de Updating ActionContext for the default constructor and the setter methods 2015-02-06 20:27:42 -08:00
Kiran Challa 2e938a51f8 [Fixes #1878] Investigate Xml formatters tests failures on Windows 2008 R2 OS 2015-02-06 13:23:12 -08:00
Youngjune Hong c7d09d7ad7 Introducing UrlActionContext and UrlRouteContext, and updating IUrlHelper accordingly 2015-02-05 19:41:21 -08:00
Ajay Bhargav Baaskaran ac6a1a6a80 Replaced status code number with constants 2015-02-05 16:43:59 -08:00
Yishai Galatzer e94cec51fa Script Tag Helper
Implement Script TagHelper
Add functional test

Resolved #1576
2015-02-05 14:35:02 -08:00
Ryan Nowak 12f8f23ccb Make BindingSource extensible
This is a major refactor of how IBinderMetadata interacts with model
binders and value providers. We're doing this to support better
extensibility for metadata in ApiExplorer.

You'll notice a bunch of deleted code in DefaultApiDescriptionProvider
that maps metadata marker interfaces to a fixed list of Api sources. This
is replaced now with IBindingSourceMetadata - which also replaces the
hierarchy of marker interfaces. Now user code can create an arbitrary
binding source and have a consistent API for model-binders,
value-providers and full-visibility in ApiExplorer as
well.

Additonally, there's some error checking in place that better enforces the
constraints we already have in the system. IE you can't create a 'greedy'
model binder that uses value-provider data.

Two additional enhancements are planned for followup PRs:
1. Add a BindingSource property to model-metadata. This will remove some
duplication, but I want to delay it because it would touch another 10 or
so files.

2. Add an extensibility interface for our 'special' model binders like the
file binder so these can show up in ApiExplorer as well.
2015-02-05 13:41:31 -08:00
Kiran Challa 8c32d9e207 Removed misplaced test files due to bad merge.
The latest version of these files are already present in Microsoft.AspNet.Mvc.Xml.Test.
2015-02-05 13:21:33 -08:00
Ajay Bhargav Baaskaran 5e704cd5ef Added custom exception message for Format Exception 2015-02-05 10:51:32 -08:00
Pranav K 59db8143da Updating CompilerCache to use IMemoryCache and file system watcher to
expire files in razor file cache.

Add a functional test to ensure the compiler cache does not get
initialized until the first request to a View.

Fixes #1708
2015-02-05 09:52:17 -08:00
Yishai Galatzer 5a3863d562 Implement StreamOutputFormatter
Include Functional tests and unit tests

Resolves #1653
2015-02-04 16:04:02 -08:00
sornaks 4691823a50 Issue #1785 - Changes to add CacheProfiles for response caching. 2015-02-04 15:25:45 -08:00
sornaks 6e8cc6ba74 Adding extension methods ConfigureMvcOptions and ConfigureRazorViewEngineOptions. 2015-02-04 14:07:07 -08:00
Harsh Gupta e805e67b4c [Fix for #1929] HeaderModelBinder needs to honor explicit name. 2015-02-03 19:36:48 -08:00
sornaks 2c5ae68ab6 Issue #1944: Move DelegatingStream to internal namespace and rename to NonDisposableStream. 2015-02-03 13:34:42 -08:00
N. Taylor Mullen c3006f6b21 React to aspnet/Razor#285.
- Cannot only provide assembly name to @addtaghelper.
2015-02-03 12:33:30 -08:00
damianedwards ad66a71eeb LinkTagHelper activates ILogger directly from DI:
- #1948
2015-02-03 11:41:50 -08:00
damianedwards 3d33418f31 Add the LinkTagHelper:
- #1580
2015-02-03 10:12:38 -08:00
Kiran Challa 49294b7d28 Removed custom object result accepting status code as out of box ObjectResult provides this already. 2015-02-02 10:20:20 -08:00
Ryan Nowak 514460b801 Making FormatFilter a Service and some test changes 2015-01-31 23:51:58 -08:00
Mugdha Kulkarni d7f2630ad2 Making FormatFilterAttribute an IFilterFactory 2015-01-31 23:18:30 -08:00
Mugdha Kulkarni 6a0f471a42 Adding ClearMediaTypeMappingForFormat to FormatterMappings and other PR comments 2015-01-31 23:18:24 -08:00
Mugdha Kulkarni addd8dd5d2 Changing produces and format filter interaction 2015-01-31 23:18:18 -08:00
Mugdha Kulkarni 7ee80020e1 Incorporating PR comments - 1/19 2015-01-31 23:15:19 -08:00
Mugdha Kulkarni c8b911b596 Adding functional tests and attribute route tests.
Incorporating PR coments.
2015-01-31 23:15:13 -08:00
Mugdha Kulkarni d91b7776b3 This is MVC part of feature URL Extensions. It does following:
1. Creates a filter called FormatFilter. This will look at the format parameter if present
   in the route data or query data and sets the content type in ObjectResult
2. It adds new options called FormatterOptions, that contains the map of format to content tyepe
3. A method in MVC options to add the formatter mapping
2015-01-31 23:15:04 -08:00
Kiran Challa e5176d22f6 [Fixes #1121,#1508] Wrap objects for serialization/deserialization and DelegatingEnumerable<> support for IEnumerable<T> and IQueryable<T> 2015-01-30 18:10:01 -08:00
Pranav K 7c7eaa264d Use CRC32 instead of MD5 for hashing the file content.
Fixes #1800
2015-01-30 18:01:24 -08:00
Doug Bunting 6524930778 React to quick cleanup in Routing
- `DefaultInlineConstraintResolver` has no need of a `IServiceProvider`
2015-01-30 17:52:10 -08:00
Harsh Gupta 8e91c1ada6 [Fix for #1850]Produces, Consumes and ObjectResult throw if there is a match all content type. 2015-01-30 15:54:58 -08:00
Doug Bunting 6cc5cfeae2 Download and install jQuery Unobtrusive Validation and its dependencies
- avoids checking these external .js files into our repo
- limit jQuery*.js versions to single value, mostly the latest but don't
  cross over to jQuery.js 2.0.x range (incompatible with IE 6, 7, 8)
2015-01-30 12:33:12 -08:00
Doug Bunting 1a62f104b4 Add functional test of `[Remote]`
- #439 (3 of 3)
- extended the Validation web site to include use of `[Remote]`
- also confirm operation of the validation actions (which all reject their input)
2015-01-30 12:33:00 -08:00
Doug Bunting 80b004678d Get `[Remote]` and supporting classes building
- #439 (2 of 3)
- correct namespaces
- correct `Resources` class and member names; add new resources
- add `RequestServices` property to `ClientModelValidationContext`
- adjust to modern `IUrlHelper` API
- add `IClientModelValidator` support in `DataAnnotationsModelValidator`
- move previously-unused `StringSplit()` to `RemoteAttribute` and rename
- rewrite `RemoteAttributeTest`
 - improve test method names

Reduce number of `[Remote]` constructor overloads
- remove `AreaReference` enum and related `[Remote]` constructor overload
 - use `null` or empty `string` as explicit reference to the root area
- generally reduce parameter validation; match `UrlHelper`

Cleanup
- correct Engineering Guidelines violations
 - especially: add doc comments
- correct spelling error in `_additonalFieldsSplit`

nits:
- minimize `null` checks in `AdditionalFields`
- make `GetClientValidationRules` `virtual`; some subclasses use `new` today
- add tests of `DataAnnotationsModelValidator.GetClientValidationRules()`
- remove `builder.ToString()` calls since it appears
  https://roslyn.codeplex.com/workitem/246 has been resolved or Moq has
  worked around that issue.
2015-01-30 12:26:48 -08:00
Doug Bunting 1af1583302 Copy `[Remote]` and supporting classes from MVC 5.2
- #439 (1 of 3)
2015-01-30 10:05:53 -08:00
Anthony Sneed 1118315a9d [Resolves #1887] XmlDataContractSerializer Input and Output Formatter Tests Cleanup. 2015-01-30 10:02:33 +01:00
Doug Bunting 8779cafbab Use `[Display(Order=x)]` to sort validation messages and properties
- #964
- compute `ModelMetadata.Order` based on `[Display]` attribute
 - property affects e.g. `@Html.DisplayFor()` generation for complex objects
 - also affects order of messages in validation summaries
- test new scenarios involving `ModelMetadata.Order`
 - per-property `ModelMetadata` and related tests
 - validation and `HtmlHelper` tests
 - add `HtmlHelperValidationSummaryTest` (which touches on #453)
- update ModelBinding functional test to show use of `[Display(Order = x)]`

nits:
- move more `NullDisplayText` bits into proper slots (just above `Order`)
 - add doc comments for `ComputeNullDisplayText()`
- add more assertions in tests using `ModelStateDictionary.HasReachedMaxErrors`
- remove some trailing whitespace
- avoid `Assert.True()` & `Assert.False()`; split some assertions up
- `""` -> `string.Empty` in affected test classes
- rename "DefaultEditorTemplatesTest~~s~~" class and file to follow guidelines
- rename "ModelBindingTest~~s~~" class and file to follow guidelines

FYI #1888 covers a predictable (or even just stable) order in the UI
2015-01-29 09:31:05 -08:00
Youngjune Hong 70efc5ae0a Creating UrlUtility for IsLocalUrl, and cleaning up UrlHelper 2015-01-29 05:51:46 -08:00
Ryan Nowak 42df4cf2ed Fix for #1538 and #1891
Changes here are all focused around MaxModelErrors on
ModelStateDictionary.

MaxAllowedErrors now defaults to 200 (same as options). This means that
constructing a new ModelStateDictionary with the default constructor will
use this default. There's a new constructor for creating a
MaxAllowedErrors with a non-default value.

The ControllerActionArgumentBinder is now responsible for setting the
value from options onto ActionContext.ModelState. This results in better
layering and guarantees the option is respected if someone uses
extensibility to call model binding.

ModelStateDictionary.CanAddErrors is renamed to MaxErrorsReached. We
wanted to change the behavior of this property, but realized that it's
very useful inside the model validation code, so opted to renamed.

There's also a bunch of doc cleanup inside ModelStateDictionary to
simplify things and improve clarity.
2015-01-28 16:53:28 -08:00
Anthony Sneed 4821108307 Add SerializerSettings property to Xml DataContractSerializer input and output formatters. 2015-01-28 23:50:16 +01:00
NTaylorMullen 3e3dd0215d React to aspnet/Razor#94.
- Implemented ITagHelperinterface for TagCloudViewComponentTagHelper in the TagHelperSample.
2015-01-27 20:20:14 -08:00
Harsh Gupta 2d15f083da Porting few tests for JsonOutputFormatter 2015-01-27 16:48:54 -08:00
Kirthi Krishnamraju f1c62ef302 Fix for #1837 - Determine model type at runtime for TryUpdateModel and added a test 2015-01-27 16:36:47 -08:00
Kirthi Krishnamraju cbed666cba Added functionaltests for ModelMetadataType attribute and moved TryValidateModel tests actions to ValidationWebSite 2015-01-27 15:56:49 -08:00
Ryan Nowak 08a578d01f Issue #1525 - Enhancements to ActionContext
- Adding a new constructor that takes ModelState.
 - Removing an extra constructor that's not needed
 - docs
 - test cleanup
2015-01-27 14:35:31 -08:00
Ajay Bhargav Baaskaran 17aa21dc25 Added StatusCode property to OutputFormatterContext
- Fixes issue #1809
 - Added relevant tests
2015-01-26 17:32:04 -08:00
Ajay Bhargav Baaskaran 8e85d53c88 Provided a way to add data to ActionDescriptor from ApplicationModel.
- Added Properties to Action, Controller and Application model
 - Added relevant tests
2015-01-26 15:20:02 -08:00
Ryan Nowak ee419e2442 Add ApiExplorer details to ApplicationModel
This change allows you to set global defaults for ApiExplorer on the
ApplicationModel. Additionally, we're more lenient about configuring
ApiExplorer = on with conventional routing. If you turn on ApiExplorer at
the application level, we'll just skip over all conventionally routed
controllers instead of throwing.
2015-01-26 14:47:11 -08:00
Ryan Nowak 8399dc5f4e Add a custom collection type for ModelMetadata.Properties
This is a cleanup PR to improve the common usage of
ModelMetadata.Properties.

We found placed in code where both .Count and the ability to index by
property name would be useful. I was able to cascade this and simplify the
ModelBindingContext as well.
2015-01-26 14:36:40 -08:00
Pranav K f93d0d82c3 Merge branch 'release' into dev 2015-01-23 17:12:16 -08:00
Pranav K 071c697318 Modify BuilderExtensions.UseMvc to not add any routes by default
Fixes #1879
2015-01-23 16:51:38 -08:00
N. Taylor Mullen 074eae6059 Fixed Microsoft.AspNet.Mvc.Common unneeded assemblyinfo. 2015-01-23 16:29:31 -08:00
Wei Wang af3044a3d1 Merge branch 'release' into dev 2015-01-23 13:21:30 -08:00
Wei Wang 5407ff3bd6 React to kpm renaming 2015-01-22 17:35:46 -08:00
Pranav K 4d77f670f6 Merge branch 'release' into dev 2015-01-22 16:47:54 -08:00
Pranav K 6c21b40894 EntryLinkHelpers.ContentLink should be available to use for user code
inside of a cache tag helper's body.

Fixes: #1867
2015-01-22 16:37:11 -08:00
Kiran Challa 5c2dc5db11 [Fixes#1792]Separate XML serializers to Microsoft.AspNet.Mvc.Xml 2015-01-22 15:09:20 -08:00
Doug Bunting bf00f478e5 Add another view to MvcTagHelpersWebSite using HTML helpers
- with some `<text>` hacks, generated HTML is almost identical to tag helper version
 - attribute order (HTML helpers consistently order alphabetically) is primary difference
- bit more testing, therefore related to #453

nits:
- remove some trailing whitespace
- clean up style in `MvcTagHelperTest[s]` and `MvcTagHelper_HomeController`
 - e.g. more init syntax, fewer duplicate variables
- correct "MvcTagHelperTest~~s~~" file / class name
- remove unused `Order.OrderNumber` property in MvcTagHelpersWebSite project
- correct one spelling mistake
2015-01-22 14:21:25 -08:00
N. Taylor Mullen baa70d284d Merge branch 'release' into dev 2015-01-22 14:02:50 -08:00
Ryan Nowak 7fbe0ce307 Merge branch 'release' into dev 2015-01-22 14:02:17 -08:00
N. Taylor Mullen 14bd7dcd5e Handle trailing semicolon after @inject.
- Made @inject handle trailing semicolons identical to @using; essentially ignores it.
- Added parser, runtime/designtime codegen and functional tests.
- Added Microsoft.AspNet.Mvc.Common.Test.
- Transitioned pre-existing Microsoft.AspNet.Mvc.Common tests to the new test project.
- Updated transitioned tests to also work in CoreCLR (except ones with moq).

#1857
2015-01-22 14:01:10 -08:00
Ryan Nowak 09928a2818 Adds parameter information to ApiExplorer
This change makes ApiDescription and ApiParameterDescription aware of all
of the new features we built into model binding for enhanced DTO support
(uber-binding).

The main change is that instead of sticking just to the declared
parameters on the action itself, we now traverse model metadata and break
the parameters down based on their logical data source.

This means that a model like the below will yield 3 parameters:

public class ProductChangeCommandDTO
{
    public int Id { get; set; }

    [FromBody]
    public ProductDetails Changes { get; set; }

    [FromQuery]
    public string AdminComments { get; set; }

    [FromServices]
    public IProductRepository Repository { get; set; }
}

The 'Repository' will be hidden, as it's not related to user input.

Additionally, we treat different sources differently. In the
above example, 'Changes' is from the body and will be treated as a
leaf-node.

However if you use nested DTOs that are bound from the query string (using
[FromQuery]) or similar, we'll recursively explore to find as much
structure as possible.

This information is combined with data from the route template to give a
much more complete picture than we ever could in the past for parameters,
especially when DTO/Command pattern is used.
2015-01-22 13:30:41 -08:00
damianedwards 759fbbd661 Added the EnvironmentTagHelper:
- #1553
2015-01-22 10:17:25 -08:00
Doug Bunting 54f88ab190 [cleanup] Update .gitignore and reset .kproj files
- add a couple more exclusions to .gitignore (recent VS additions)
- remove `<ProjectExtensions/>` elements
- update files that don't have the correct output directories
- remove dangling PrecompilationWebSite.kproj file
2015-01-21 22:03:23 -08:00
Kiran Challa 0e9091f0eb [Fixes #1841] Change XML DCS and XmlSerializer output formatters to not derive from the base XmlOutputFormatter 2015-01-20 17:22:04 -08:00
Chris Ross d51dad9560 Handle IFileSystem rename. 2015-01-20 12:16:30 -08:00
Pranav K 7667eba34e Layouts for partials
Fixes #1621
2015-01-20 11:44:48 -08:00
Kirthi Krishnamraju 9299565706 Revert "Revert "Added SetAntiForgeryCookieAndHeader method that sets cookie token and header""
This reverts commit c8a13087a6.
2015-01-20 10:51:44 -08:00
Kiran Challa eda4b16cc5 [Fixes #1836]SupportedMediaTypes for output formatters are incorrectly updated with charset data during requests 2015-01-20 06:50:06 -08:00
Pranav K c8a13087a6 Revert "Added SetAntiForgeryCookieAndHeader method that sets cookie token and header"
This reverts commit 951ed05893.
2015-01-20 00:49:15 -08:00
Kirthi Krishnamraju 951ed05893 Added SetAntiForgeryCookieAndHeader method that sets cookie token and header 2015-01-19 17:58:12 -08:00
Ajay Bhargav Baaskaran 67b078862e Fixed content-disposition quoted filename bug 2015-01-19 13:15:18 -08:00
Stephen Halter d34554e3ff Handle HttpFeature rename 2015-01-18 21:06:12 -08:00
Ryan Nowak 0c5a702245 Changing when controllers are created
This change moves controller creation to the stage immediately before
model binding. The controller will be disposed/released before Resource
Filters run their 'OnResourceExecuted' method. Previously the controller's
lifetime surrounded all filter invocation.

Additionally, the Controller property is now gone from ActionContext, and
is moved to the 4 filter contexts that should have access to it
Action*Context and Result*Context.
2015-01-16 20:23:39 -08:00
Ryan Nowak 12c2759cec Fix for #384 - And some other changes to controller as filter
This is a major change to how we handle the scenario where a controller is
a filter. We want to change the lifetime of the controller object, by
scoping it around action filters and result filters. This means that a
controller class can only implement action filters and result filters.

To implement #384 - we're creating a delegating filter class
'ControllerFilter' which will forward calls to the implementation of the
controller. This is discovered in the controller model and added to the
filter collection. This filter is removable as an opt-out of this feature.

The ControllerFilter only implements action filter and result filter, so
the new restriction about filter types on Controller is in place. A future
change will move the instantiation of the controller to after resource
filters.
2015-01-16 19:15:59 -08:00
Ryan Nowak 51e7812e7e Fix for #1722 - FromHeader does not respect default value
This change adds support for our three-valued logic to the default value
handling part of the MutableObjectModelBinder.

The issue is that we want to look up a default value when a 'greedy' model
binder returns true but doesn't find a value.

We also don't want to call the property setter unless there is:
1). A value from model binding OR
2). A default value
2015-01-16 17:59:00 -08:00
Ryan Nowak 692a07240c Some cleanup of ActionResults - #657
In general all properties are get/set so filters can change them.
 - some validate for not-null
 - where we use services it's get/set also

Services are resolved in the Execute method if not provided.

A few more ActionResults that return a body have the ability to set a
status code now (optional).
2015-01-16 17:29:56 -08:00
Kirthi Krishnamraju e41e5066f9 Added support for TryValidateModel and its corresponding tests 2015-01-16 17:23:59 -08:00