Commit Graph

212 Commits

Author SHA1 Message Date
Doug Bunting c74a945dda
Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture` (#8674)
* Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture`
- #8578
- user may override this choice in one case:
  - register a custom `IValueProviderFactory` to pass another `CultureInfo` into the `RouteValueProvider`
- values are used as programmatic tokens outside `RouteValueProvider`

nits:
- take VS suggestions in changed classes
- take VS suggestions in files I had open :)
2018-10-30 20:09:17 -07:00
Patrick Westerhoff ddbe0fef26 Allow custom handling of antiforgery failures
To enable custom handling of antiforgery validation failures, use an
`AntiforgeryValidationFailedResult` which is just a `BadRequestResult`
but allows to be identified explicitly inside always-running result
filters using the `IAntiforgeryValidationFailedResult` marker interface.
2018-10-19 13:47:08 -07:00
Doug Bunting 5bddd226a3
Use Internal.AspNetCore.Sdk as an MSBuild SDK
- should resolve issues with occasional strange MSBuild caching issues in this repo
- modeled after aspnet/Scaffolding#905
- follows aspnet/BuildTools#729 recommendation to check in global.config file
  - see also Microsoft/msbuild#2914
- use newer KoreBuild
  - `.\build.cmd -update /t:noop`
2018-10-04 15:12:38 -07:00
Simon Cropp 43d4416a1d Fix typos (#8413) 2018-09-12 09:34:45 -07:00
Simon Cropp b156dee4f1 Fix some spelling (#8378) 2018-09-06 07:39:01 -07:00
James Newton-King 5cdc172b17
Fix obsolete constraint resolver usage (#8361) 2018-08-30 13:28:46 +12:00
Ben Adams c7f6e7ab2f Grumpy XUnit 2018-08-29 16:18:25 -07:00
Pranav K 522006d2c8
[Design] Add a MaxValidationDepth option to ValidationVisitor
Fixes #7357
2018-08-16 15:01:18 -07:00
Artak Mkrtchyan 6d9aa281c5
Render `maxlength` attribute for an input tag, when MaxLength or StringLength validation attributes are applied to the model class. 2018-08-02 13:44:19 -07:00
Pranav K 9d951325b2
Re-organize shared src packages so we can do true IVT between src assemblies 2018-07-16 11:15:58 -07:00
Pranav K 8e31319215
Prevent null refs in some simple cases in CachedExpressionCompiler
Fixes #6928
2018-05-29 11:09:48 -07:00
Ryan Brandenburg edf4e8fd9e DataAnnotations of Enum values use DataAnnotationLocalizerProvider 2018-05-25 16:00:00 -07:00
Pranav K e1eaf6a6e0
Cleanup TestCommon 2018-05-18 10:45:57 -07:00
Pranav K 777782ac6e Test cleanup 2018-05-03 16:03:42 -07:00
Doug Bunting e0e96ce53b
Include parameter type's attributes in ModelMetadata
- #7595
- #7595 relates to #7350 but does not have the same root cause
  - did _not_ revert the src changes in #7350 fix (d995b0418a)
- make non-`[Obsolete]` `ModelAttributes` constructor overload `internal`
  - should generally use `static` methods and not any constructor
  - change some unit tests to use `[Obsolete]` constructor overloads (with suppressions)
- fix test `ParameterBinderExtensions` to use current `ParameterBinder.BindModelAsync(...)` overload
  - found some tests updated `IModelMetadataProvider`, `MvcOptions`, etc. instances but didn't register them in DI
- extend `ModelBindingTestHelper` and `ModelBindingTestContext`
  - reorder some tests to use correct `MvcOptions` and `IModelMetadataProvider` everywhere
  - fixes above issues

nits:
- take a few VS suggestions
- remove an old comment indended only for PR "Reviewers:"
2018-04-17 12:40:38 -07:00
Kiran Challa e52933e4e3 Removed UrlTestEncoder references in tests
This is because with the following commit, Routing no longer depends on DI to get a UrlEncoder and always uses UrlEncoder.Default.
4184b2406d
2018-04-14 06:08:20 -07:00
Pranav K fdc4df35ed
Fix build break 2018-04-02 10:29:46 -07:00
Pranav K c7559e1ff4
Merge pull request #7590 from aspnet/release/2.1
Release/2.1
2018-04-02 09:49:14 -07:00
Pranav K c515cece8e Use ModelMetadataProvider to infer BindingSource on application model 2018-04-02 09:48:49 -07:00
Pranav K 133dd964ab Introduce ViewDataAttribute
Allow properties on controllers, Razor Page and Razor Page models annotatted with [ViewDataAttribute]
to populate ViewDataDictionary

Fixes https://github.com/aspnet/Mvc/issues/6525
2018-03-30 14:19:52 -07:00
Pranav K ccb6793126
Introduce LifecycleProperty
Update TempDataAttribute infrastructure to use LifecycleProperty
2018-03-22 10:18:36 -07:00
Doug Bunting 869825b16c
Quick fix: Add test of #2890
- tests added (ages ago) in aspnet/Mvc@a045324 no longer fail when `__` handling removed
2018-03-19 11:59:52 -07:00
Doug Bunting f061d328d9
Do not use `FormattedModelValue` in password editor template
- #7418
- add quirk switch to reverse this if necessary
2018-03-05 08:33:16 -08:00
Jass Bagga 8d1c85ab74
Add overload for AddModelError without ModelMetadata (#7407)
Addresses #6102
2018-03-02 11:03:46 -08:00
Doug Bunting daf341df35 Add more tests of #7033 scenarios 2018-02-21 15:11:52 -08:00
Charlie Daly 4f3e044928 HtmlHelper.DisplayTextFor should use DisplayAttribute of enums
- #7033
2018-02-21 15:11:51 -08:00
Fabien Lavocat c062d637fe Add new contructor in SelectListItem.cs 2018-02-06 11:01:24 -08:00
Javier Calvarro Nelson 17a407bba2 [Fixes #7271] Support covariant casting of ViewDataDictionary<T>
On HtmlHelper<T> we now support contextualizing an instance of
HtmlHelper<TBase> with a ViewDataDictionary<TDerived> in
ViewContext.ViewData.

This can happen in some situations when the model for a RazorPage has
been changed using a page application model convention.

In these cases we just build a new ViewDataDictionary<TBase> and pass in
the TDerived model as an instance.
2018-01-23 17:31:03 -08:00
Kiran Challa 00c6b53b06 [Fixes #7115] Update property type check in SaveTempDataPropertyFilterBase to match TempDataSerializer requirements 2018-01-10 15:08:01 -08:00
Pranav K b196708a3e Merge tag '2.0.2' into dev 2018-01-10 10:02:54 -08:00
Doug Bunting ecedbd5372 Allow `null` or empty `fullName` in one special case
- #6662
- users can now provide a `name` or `data-valmsg-for` attribute to avoid `ArgumentException`s
  - affects `<input>`, `<select>`, `<textarea>` elements and validation message `<div>`s
- remove `fullName` check in `DefaultHtmlGenerator.GetCurrentValues(...)` entirely

The new workaround is _not_ identical to changing `ViewData.TemplateInfo.HtmlFieldPrefix`
- does not change where expression values are found in `ModelState` or `ViewData`
- likely needs to be combined with additional workarounds i.e. for advanced use only

nits:
- clean up some excessive argument naming; add a few missing argument names
- take VS suggestions in changed classes e.g. inline a few variable declarations
- clean up some test data
2018-01-09 08:53:37 -08:00
Doug Bunting 1fa1d7df3e Add missing `RenderPartial(...)` overload
- #7127
- also remove some redundant `null` checks
2018-01-05 11:27:54 -08:00
N. Taylor Mullen 7cea779b7a Update JsonHelper to escape HTML.
- This functionality can be disabled by setting the `Switch.Microsoft.AspNetCore.Mvc.AllowJsonHtml` switch in an app.config.
- Updated tests to react to this new behavior.
- Exposed a new `PublicSerializerSettings` property on `JsonOutputFormatter` so we can accurately copy settings from the used output formatter in `JsonHelper`.
2017-12-07 16:12:43 -08:00
Kiran Challa e09ea40551 [Fixes #6591] TempData should support nullable types 2017-12-04 15:33:22 -08:00
Jass Bagga 5fffd464cd
Support input type "week" (#7045) 2017-11-16 16:00:15 -08:00
Pranav K b6144142fe Update samples and tests to target netcoreapp2.1 2017-11-13 14:58:40 -08:00
Jass Bagga bb07119b4a
Handle "month" input type (#7022)
Addresses #6615
2017-11-09 10:25:36 -08:00
Nate McMaster 2e4bc548f5
Pin tool and package versions to make builds more repeatable (#7013) 2017-10-31 19:18:14 -07:00
Pranav K 41efa409a4 Remove TestOptionsManager 2017-10-30 17:49:15 -07:00
Nate McMaster 3bfb023679 Update how PackageReference versions are set
Changes:
 - Remove floating versions
 - Disable myget feeds during a Universe build
 - Use package-specific MSBuild variables. Pattern = `packageId.Pascalize() + "PackageVersion"`, with a few exceptions.
2017-10-09 11:11:24 -07:00
Nate McMaster 3f02482617 Minor test code changes to resolve xUnit2013 build error 2017-10-05 16:04:20 -07:00
Ryan Nowak 38712609bb Design extensibility for executors
We have all of these executors but they aren't really
documented/supported for extensibility today. This change introduces a
pattern for action result executors so we can make them extensible.
2017-09-22 10:32:55 -07:00
Doug Bunting fd9cb08790 Add Switch.Microsoft.AspNetCore.Mvc.UseDateTimeTypeForDateTimeOffset quirks mode
- patch recipients can use switch to undo the #6648 fix
2017-09-18 15:13:43 -07:00
Doug Bunting 6041c6b966 Auto-select `type="text"` for `DateTimeOffset` values
- cherry-picked from 7e4a8fe in dev
- #6648
- a different take on #4871
- `DateTime` can also round-trip `DateTimeKind.UTC` with `[DataType("datetimeoffset")]` or `[UIHint("datetimeoffset")]`
- since they're now handled differently by default, add more `DateTime` tests
- expand tests involving `Html5DateRenderingMode.CurrentCulture`

nits: make VS-suggested changes to files updated in this PR
2017-09-18 15:13:33 -07:00
Kiran Challa 3beb310866 Avoid saving TempData in case of unhandled exceptions. [Fixes #6598] BUG? Accessing TempData prevent response to have content on error. 2017-09-07 13:13:27 -07:00
Doug Bunting 7e4a8fe479 Auto-select `type="text"` for `DateTimeOffset` values
- #6648
- a different take on #4871
- `DateTime` can also round-trip `DateTimeKind.UTC` with `[DataType("datetimeoffset")]` or `[UIHint("datetimeoffset")]`
- since they're now handled differently by default, add more `DateTime` tests
- expand tests involving `Html5DateRenderingMode.CurrentCulture`

nits: make VS-suggested changes to files updated in this PR
2017-09-05 16:05:13 -07:00
Doug Bunting 8645ada6b5 Remove no-op behaviour for no-content `<label></label>` elements
- #6638
2017-08-31 09:21:44 -07:00
bchavez 16c267d95e House Cleaning - Spelling and grammar 🚿 2017-08-30 14:58:44 -07:00
Nate McMaster b811e69d00 Use PackageLineup to manage PackageReference versions
- Move the Mvc.Performance project from test/ to benchmarks/.
 - Remove the Version attribute on PackageReference.
 - Add a reference to two PackageLineup's.
 - Add snippet to README explaining the additional requirement to run build.cmd /t:restore.
 - Add a target to check that packages have been pinned.
2017-08-30 12:14:11 -07:00
Kiran Challa b2f9ad1b67 Changed CookieTempDataProvider's CookieSecurePolicy from SameAsRequest to None 2017-08-29 14:55:52 -07:00