Commit Graph

84 Commits

Author SHA1 Message Date
apxoht 1c34d88f4c Removed unnecessary dependency of IActionSelector in UrlHelper 2015-11-23 15:44:55 -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
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
John Luo 46cd4ac1f0 Reacting to ApplicationServices removal from HttpContext 2015-11-19 16:32:58 -08:00
Doug Bunting 79d74127b9 Add temporary workarounds for aspnet/External#50 and aspnet/Mvc#3587 2015-11-19 15:50:00 -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
Pranav K 292207d17d Reacting to DependencyInjection changes 2015-11-13 10:47:34 -08:00
ryanbrandenburg b8d58133c3 * Add NoContent Factory to Controller 2015-11-12 14:56:05 -08:00
Cesar Blum Silveira 4a68550e50 Merge branch 'release' into dev 2015-11-11 10:59:32 -08:00
Kiran Challa 5364468001 [Fixes #3177] Clean up logic for encoding in ViewResult and friends 2015-11-06 10:44:09 -08:00
Cesar Blum Silveira 9dba871108 Strong name everything. 2015-11-03 21:16:49 -08:00
Ryan Nowak e2c2676042 Add InputFormatter buffer pooling 2015-11-02 14:36:59 -08:00
Doug Bunting ff91e796c1 Revert "Fixing tests"
- wrong fix especially now that test encoders work as expected
- touch up `HtmlHelperTest` and `RazorViewTest` since test encoders are now consistent
- remove references to old `Microsoft.Extensions.WebEncoders.Testing` package

This reverts commit a9d5876cd9.
- but leave `FormTagHelperTest` and `ValidationMessageTagHelperTest` cleanup alone

nit: use `string.Empty` in `HtmlHelperLinkGenerationTest`
2015-11-02 09:45:56 -08:00
Chris R 52f4a83139 React to WebEncoders changes. 2015-10-30 17:59:19 -07:00
Pranav K 0fedda5855 Allow enums to be serialized by SessionStateTempDataProvider
Fixes #3141
2015-10-24 08:16:19 -07:00
Ajay Bhargav Baaskaran eb398c811d Added LocalRedirectresult
- Fixes #3346
- Added helper method in controller
- Added relevant tests
2015-10-23 12:58:41 -07:00
Ajay Bhargav Baaskaran 624c918de5 [Fixes #3274] Added DiagnosticsSource for ViewComponent 2015-10-23 12:51:12 -07:00
ryanbrandenburg 0b8fe87596 * Allow null ViewData and TempData 2015-10-22 17:28:26 -07:00
Doug Bunting c267ef3904 Rename `AppendEncoded()` to `AppendHtml()` and `SetContentEncoded()` to `SetHtmlContent()`
- #3225, 3 of 3
2015-10-22 16:57:47 -07:00
Doug Bunting 40b7636b72 Use `ModelMetadata.GetDisplayName()` in error message replacing `FormatException` and `OverflowException`
- #3227
- much of change is to tests, creating and passing `ModelMetadata`
- updated `InputFormatterContext` to make `ModelMetadata` available to `JsonInputFormatter`
  - walk `ModelMetadata` tree to get information about property with an issue
- add missing `null` checks in `ModelStateDictionaryExtensions`
2015-10-22 15:50:36 -07:00
ryanbrandenburg da731fc641 Add logging to ActionResults and ControllerActionInvoker 2015-10-21 13:16:14 -07:00
Eilon Lipton 55b72c04bf Add high-pri doc comments for views, controllers, HTML helpers, Startup 2015-10-20 18:24:56 -07:00
Pranav K 8b0c157296 Rename ModelState (the type) -> ModelStateEntry
Fixes #3326
2015-10-20 16:43:00 -07:00
Ryan Nowak 173f00fda7 Update to use DiagnosticSource 2015-10-20 11:47:29 -07:00
Ajay Bhargav Baaskaran d40e6612a4 Moving the order of generated hidden tags for checkbox to end of the form
- #2994
- Affects both HtmlHelper and TagHelper scenarios
- Checkboxes not enclosed in a form will generate inline hidden tags
- Added necessary properties to FormContext
- Added some functional and unit tests
2015-10-14 15:43:13 -07:00
Ryan Nowak 9342cb0ab7 Suppress [Obsolete] warnings from DiagnosticSource 2015-10-08 12:47:08 -07:00
Pranav K 30f5826380 Use Type.GetMethod in ViewComponentMethodSelector
Fixes #3211
2015-10-06 16:21:56 -07:00
Pranav K a602d548e2 Allow ViewFeature tests to run in dnxcore50 2015-10-06 09:46:49 -07:00
Pranav K f57e180971 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:53 -07:00
Ryan Nowak 6185b16795 Custom dictionary type for attributes 2015-10-02 18:08:58 -07:00
Ryan Nowak 4e08eda58d Use pooled memory for the streamwriter 2015-10-02 14:35:15 -07:00
Ryan Nowak 306776ff63 Minor cleanup/refactor of ViewResult
- Make ViewExecutor a service
- Add facades for ViewResult/PartialViewResult
- Add eventing for ViewFound/NotFound in PartialViewResult
- Add eventing around view execution
- Cleanup of some various eventing & our tests code
2015-10-02 08:18:00 -07:00
Kiran Challa 130d94eb7e [Fixes #3068] TempData fails silently without sessions middleware 2015-10-01 19:28:46 -07:00
Ajay Bhargav Baaskaran eefa58e617 [Fixes #3043] Overflow exceptions converted to invalid value messages 2015-09-29 16:24:19 -07:00
Ryan Nowak 0d6edf240a Move ModelExplorer to ViewFeatures 2015-09-28 14:14:40 -07:00
Pranav K 18c80d156c Replace NotNullAttribute with thrown exceptions 2015-09-26 23:48:43 -07:00
Doug Bunting eff10cdd66 Move `ModelStateDictionaryExtensions` into `Microsoft.AspNet.Mvc.ModelBinding` namespace
- missed the inconsistency when reviewing
- kept class in ViewFeatures assembly because it depends on `ExpressionHelper`

nit: wrap some long lines
2015-09-26 18:15:04 -07:00
Muchiachio b28debf442 Generic ModelStateDictionary add and remove extensions
- Added generic add model error and remove extensions for
ModelStateDictionary, to avoid using hard coded strings then specifying
model state dictionary keys.
- Added generic removal all  extension for ModelStateDictionary, to
support removing all the model state keys for given expression.

aspnet/Mvc#3164
2015-09-26 18:14:58 -07:00
Pranav K 6a0a24481a Asynchronously flush the HttpResponseStreamWriter after a view has been rendered.
This solves a perf issue for views which produce content that is smaller
than the buffer size of HttpResponseStreamWriter. In this case, the writer
ends up synchronously writing to the Response as part of Dispose which
affects perf.
2015-09-25 21:07:15 -07:00
Kirthi Krishnamraju 0889b18f95 Add localizers to validation attributes 2015-09-25 16:13:21 -07:00
Ajay Bhargav Baaskaran 9c81b95d1b Renamed Controller.Context to Controller.HttpContext
- #3165
2015-09-25 11:01:30 -07:00
Ryan Nowak b544aabfdb Fix #3111 - Don't trounce content-type in VCR
This change makes ViewComponentResult respect an existing Content-Type
setting on the HttpResponse. Code is very similar to the code in
ViewExector, and includes the same quirks.
2015-09-21 23:20:20 -07:00
Ryan Nowak a318c4599a API Review - Split up .Actions
Abstractions - Core MVC extensibility

Controllers - MVC implementations of .Abstractions and supporting
contracts

Infrastructure - General purpose support APIs. Metadata APIs that don't
fit clearly with a feature or with .Abstraction
2015-09-21 21:54:02 -07:00
Pranav K 7b433820b1 Changes per PR comments
Reformatting parameter identation
2015-09-17 15:42:58 -07:00
Pranav K a68d9e4cb1 Replace NotNullAttribute with thrown exceptions 2015-09-17 11:56:44 -07:00
Ryan Nowak 538cd9c191 Move less-commonly used types out of .Rendering 2015-09-16 23:52:29 -07:00