Commit Graph

729 Commits

Author SHA1 Message Date
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