Commit Graph

27 Commits

Author SHA1 Message Date
Ryan Nowak 9fc3a80056 Remove IActionContextAccessor from UrlHelper
This change removes the IActionContextAccessor as a dependency of
UrlHelper, and shifts UrlHelper to use a factory pattern. Consumers of
IUrlHelper should create an instance using the factory when needed.

This is the last part of MVC that has a dependency on IActionContext
accessor. As part of this change we no longer register it by default, and
treat it as an optional component.
2015-12-02 17:09:43 -08:00
Pranav K 7e2eb16960 React to Microsoft.AspNet.Html namespace rename 2015-12-02 11:15:54 -08:00
Ryan Nowak 07085ca69b Remove IHttpContextAccessor from TempData
This change removes the dependency of TempData on the IHttpContextAccessor
by creating an ITempDataDictionaryFactory abstraction. In general, no one
will replace the factory, it's just indirection.

This allows us to drop our dependency on IHttpContextAccessor, and move it
to the functional tests where we specifically depend on it.

The bulk of code churn here is to update tests that use TempData.
2015-12-02 08:18:57 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -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 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
Kiran Challa 5364468001 [Fixes #3177] Clean up logic for encoding in ViewResult and friends 2015-11-06 10:44:09 -08:00
Ryan Nowak e2c2676042 Add InputFormatter buffer pooling 2015-11-02 14:36:59 -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
ryanbrandenburg 0b8fe87596 * Allow null ViewData and TempData 2015-10-22 17:28:26 -07:00
Ryan Nowak 173f00fda7 Update to use DiagnosticSource 2015-10-20 11:47:29 -07:00
Ryan Nowak 9342cb0ab7 Suppress [Obsolete] warnings from DiagnosticSource 2015-10-08 12:47:08 -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
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
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
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
Ryan Nowak 538cd9c191 Move less-commonly used types out of .Rendering 2015-09-16 23:52:29 -07:00