Commit Graph

1467 Commits

Author SHA1 Message Date
apxoht 7e1a6222aa Removed unused private method in DefaultActionSelector 2015-11-30 17:14:28 -08:00
Ryan Nowak 6875ee55d3 Remove Magic Link Generation
This change resolves #3512 and #3636 by removing 'magic' link generation
and adding an extension method to add routes to areas correctly using the new
pattern. This is pretty much exactly the same as how MapWebApiRoute works.

For site authors, we recommend adding area-specific routes in a way that
includes a default AND constraint for the area. Put your most specific
(for link generation) routes FIRST.

Ex:

  routes.MapRoute(
      "Admin/{controller}/{action}/{id?}",
      defaults: new { area = "Admin" },
      constraints: new { area = "Admin" });

The bulk of the changes here are to tests that unwittingly relied on the
old behavior.
2015-11-30 11:24:23 -08:00
ryanbrandenburg 91e837d465 * Debug log exceptions in JsonInput deserializing 2015-11-30 11:19:22 -08:00
ryanbrandenburg d22d6793ba * Include DisplayName in errorMessage 2015-11-30 11:18:14 -08:00
Pranav K c5346f7bf9 Use string.IsNullOrEmpty instead of string.IsNullOrWhitespace
Fixes #3593
2015-11-30 10:00:44 -08:00
N. Taylor Mullen 490fcf1ab4 Remove the use of `Linq` and unneeded enumerators from Mvc `TagHelper`s.
- Prior to this change we were using `Linq` throughout our `TagHelper`s which resulted excess allocations.
- Also went through our data structures and changed some from `Enumerable<T>` to `IList<T>` where we were just not exposing the more accessible types (list).
- Changed several locations of `foreach` to `for` to remove the enumerator allocation.

#3599
2015-11-25 21:31:24 -08:00
Ryan Nowak a14fdd8637 Remove FormatFilter dependency on IActionContextAccessor
This change simplifies IFormatFilter's API and removes the dependency on
IActionContext accessor.

The old API for IFormatFilter required computing state based on the
current request as part of the constructor, which in turn implied the use
of a context accessor. This isn't really needed. I didn't preserve caching of
the 'format' as that seems like an early optimization.
2015-11-25 17:01:16 -08:00
Ryan Nowak d8cc2b85d5 Adds ActionContext to Validation contexts
This change makes it possible to access the ActionContext/ActionDescriptor
from inside of validators and client validators.
2015-11-25 16:38:26 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -08:00
Ryan Nowak 0832365ec2 Adds ActionContext to OperationBindingContext
This change makes it possible to access the ActionContext/ActionDescriptor
from inside of modelbinding.
2015-11-25 15:17:09 -08:00
Kiran Challa 31e42ee312 [Fixes #3433] Invalid media type 'text/plain; charset=utf-8' 2015-11-25 10:50:40 -08:00
Ryan Nowak 4bcf236450 MVC companion to aspnet/Routing#238
This is a companion change to make the RouteValueDictionary type more
promient. Using the concrete type here allows to avoid allocations in a
lot of common scenarios.
2015-11-25 10:36:50 -08:00
Doug Bunting 6e299d695f Update `DefaultHtmlGenerator.GenerateAntiforgery()` to match latest `IAntiforgery.GetHtml()`
- #3123 (3 of 5 or so)
- react to rest of aspnet/Antiforgery@6a9b38d
  - remove `HtmlEncoder` from localization requirements
  - literal `hidden` is no longer HTML encoded (was a no-op anyhow)
2015-11-25 09:49:15 -08:00
Pranav K 79d517483b Removing PageInstrumentation
Fixes #3497
2015-11-25 08:41:21 -08:00
Pavel Krymets 5ef14e95b7 React to dnx confguration change 2015-11-24 11:54:10 -08:00
apxoht 1c34d88f4c Removed unnecessary dependency of IActionSelector in UrlHelper 2015-11-23 15:44:55 -08:00
ryanbrandenburg b6f8c523a8 * Remove MvcSample and replace with MvcSandbox 2015-11-23 11:53:48 -08:00
ryanbrandenburg 4a61dfec6d * Make HttpMethodConstraint case insensitive 2015-11-23 11:50:44 -08:00
Doug Bunting eb70b1c28c Remove `WebUtility` use and handle `IHtmlContent` return values from view components
- #3571 and part of #3123
- split `ContentViewComponentResult` in two
- add `HtmlEncoder` to `ViewComponentContext`
- remove use of `WebUtility.HtmlEncode()` and `HtmlDecode()`

nits: remove unused `using`s in files I had open
2015-11-23 11:12:44 -08:00
Doug Bunting 45ff0a269c Make `ModelBinderAttribute.BindingSource` setter `protected`
- #3428
- the `public` setter was not useful when this class is used as an attribute
- make property `virtual` to support other override patterns
- update existing test to use both override patterns
2015-11-20 16:31:27 -08:00
Ryan Nowak 8682fe0cfd Replace ActionBindingContext with ControllerContext
This change introduces ControllerContext for inside of Controllers, and
controller-specific extensibility points. ControllerContext carries with
it the model binding infrastructure needed to do all of the things that
controllers need to do.
2015-11-20 15:32:37 -08:00
Doug Bunting 62978229c4 Ease unit testing of `Controller.TryValidateModel()`
- #3586
- reverse conditions to access `_options.Value` only when test has set up an `IStringLocalizerFactory`
2015-11-20 10:37:07 -08:00
N. Taylor Mullen 2dc13b523d React to aspnet/Razor#358.
- Removed `WriteTagHelperAsync` methods from `RazorPage`.
- Moved `WriteTagHelperAsync` tests into Razor since `TagHelperOutput` is now an `IHtmlContent`.
- Updated code generation test files.

aspnet/Razor#358
2015-11-20 10:05:48 -08:00
John Luo d78abf267e Missed update when reacting to removing ApplicationServices from HttpContext 2015-11-19 21:07:33 -08:00
John Luo 46cd4ac1f0 Reacting to ApplicationServices removal from HttpContext 2015-11-19 16:32:58 -08:00
Pavel Krymets f25aab8df7 React to hosting changes 2015-11-19 16:12:50 -08:00
Doug Bunting 79d74127b9 Add temporary workarounds for aspnet/External#50 and aspnet/Mvc#3587 2015-11-19 15:50:00 -08:00
Ryan Nowak d6bda0ec11 CompilerCache should not compile multiple assemblies for the same page.
Fixes #3469
2015-11-19 15:12:15 -08:00
Pranav K 155bde0fcf Pass in the area name instead of the view name to a parameter that
requires an area name.

Fixes #3556
2015-11-18 17:50:14 -08:00
Doug Bunting 95b3d2c1dd Address PR comments
- removed `isMainPage` parameter to `GetPage()` and `FindPage()`
2015-11-18 15:59:46 -08:00
Doug Bunting 3be6167aa0 Switch concepts from misnamed `isPartial` to `isMainPage`
- `true` has the opposite meaning now but most changes are due to new parameters names in `IViewEngine`
  - use name names in `Microsoft.AspNet.Mvc.ViewFound` and not found events
- remove `IRazorPage.IsPartial` and `RazorView.IsPartial`
  - remove `IsPartial` properties from `Microsoft.AspNet.Mvc.Razor.BeginInstrumentationContext` and end events
- add parameter checks to `RazorView` constructor; instances are not retrieved from DI

nits:
- remove unused `cacheKey` parameter from `RazorViewEngine.CreateCacheResult()`
- correct duplicate test names in `RazorPageTest`
  - also `...OnPageExecutionListenerContext` -> `...OnPageExecutionContext`
2015-11-18 15:59:37 -08:00
Doug Bunting cf30bb730f PR comments and some smallish cleanup
- `IRazorViewEngine.MakePathAbsolute()` -> `GetAbsolutePath()`
- set `IsPartial` on all `IRazorPage` instances
- improve consistency of methods in `HtmlHelperPartialExtensions`
  - a couple unnecessarily passed `htmlHelper.ViewData`
  - add missing tests of these extension methods
- restore parameter checks in `CompositeViewEngine`
- reduce `List<string>` and remove enumerator allocations in `CompositeViewEngine`

nits:
- correct a few comments
- use `<seealso/>`
2015-11-18 15:59:28 -08:00
Doug Bunting d1fe824b5d Improve `SearchLocations` handling
- do not blindly use `FindPage()` / `FindView()` result in `Exception.Message` or returned results
  - failure scenarios involve new `Any()` calls but rarely additional `List<string>()` allocations
- change `ViewEngine_ViewNotFound` resource to be consistent with similar errors
  - remove trailing period at end of searched locations list

nit: remove remaining `null` checks of `SearchedLocations` in not found cases; never `null` then
2015-11-18 15:59:20 -08:00
Doug Bunting 08dd77d8c7 Add relative view path support
- #3307
- relative paths are now supported in `View()` calls from components and view components,
  `Html.PartialAsync()` and similar calls, and `RazorPage.Layout` settings.
  - support absolute paths, relative paths, and view location lookups consistently / everywhere
  - support view paths in `TemplateRenderer` e.g. passing an absolute path to `Html.EditorFor()`
- take a big swing at the `IRazorViewEngine` and `IViewEngine` interfaces
  - split lookups (view names) from navigation (view paths)
  - remove `Partial` separation; use parameters to set `IsPartial` properties
- correct `ViewContext` copy constructor and add unit test
- extend unit tests to cover relative paths
  - fix existing tests to handle newly-required extension in an absolute path
- add functional test that chains relative paths

nits:
- remove some YOLO line wrapping
- `""` -> `string.Empty`
2015-11-18 15:59:11 -08:00
Kiran Challa 85080ae621 Make Cors filters run before any other authorization filters 2015-11-18 10:51:49 -08:00
Kiran Challa 982c7abea8 [Fixes #3503] Removing formatters on a given type only works on collections in MVC options 2015-11-18 09:56:44 -08:00
Ryan Nowak a65a6a7cab React to change in Razor 2015-11-18 09:53:24 -08:00
Pranav K b520b0cb22 Limit [FromServices] to apply only to parameters
Fixes #3507
2015-11-17 16:41:04 -08:00
herecydev db94a8ed19 Removed redundant null checks and tested logging 2015-11-17 15:32:54 -08:00
Ajay Bhargav Baaskaran 01102bba3f Moving Attribute Routing to Routing 2015-11-17 11:02:58 -08:00
Ryan Nowak e75eebbed0 Pool JsonSerializer for Output formatting 2015-11-16 10:43:02 -08:00
Pranav K f6270de387 Updating Microsoft.AspNet.Mvc.WebApiCompatShimTest to use Microsoft.Extensions.DependencyInjection 2015-11-13 13:40:31 -08:00
Pranav K e8427349a1 Missed one type in DI reaction 2015-11-13 11:12:50 -08:00
Pranav K 292207d17d Reacting to DependencyInjection changes 2015-11-13 10:47:34 -08:00
Ajay Bhargav Baaskaran b8b222b295 Replace InnerAttributeRoute with TreeRouter 2015-11-12 15:52:51 -08:00
ryanbrandenburg b8d58133c3 * Add NoContent Factory to Controller 2015-11-12 14:56:05 -08:00
N. Taylor Mullen a1af85beb7 Remove System beta tag in project.json for coreclr packages. 2015-11-12 12:24:39 -08:00
Cesar Blum Silveira 4a68550e50 Merge branch 'release' into dev 2015-11-11 10:59:32 -08:00
Kirthi Krishnamraju 454ff9f52a fix #3414 : RegularExpressionAttribute generates wrong data-val-regex message 2015-11-10 10:27:53 -08:00
Pranav K 380a93d370 Redesign RazorViewEngine caching
Fixes #3337
2015-11-10 10:18:25 -08:00