Commit Graph

86 Commits

Author SHA1 Message Date
Ryan Nowak c93c168df3 Add mapping service for action results
This allows the use of custom 'envelope' types like ActionResult<> with
a corresponding API Explorer implementation.

Basically this PR services to decouple a bunch of infrastructure from
ActionResult<>.
2018-03-27 17:13:41 -07:00
Pranav K 927af3125e
Use RazorCompiledItemMetadataAttribute to calculate route 2018-03-27 12:24:37 -07:00
Doug Bunting 5e245da326
Add compatibility switch controlling parameter metadata and top-level validation
- #7413 part 1 of 2
- made all `ModelMetadataProvider` and `ObjectModelValidator`-specific code conditional
  - fortunately, `MvcOptions` easy to get; affected code is primarily `internal` or pub-`Internal`
  - remove unnecessary `ModelMetadataProvider` use in `ApiBehaviorApplicationModelProvider`
- run integration and functional tests with `CompatibilityVersion.Version_2_1`
  - functional test change depends on @javiercn's recent #7541 fix
  - remove test code now redundantly turning compatibility switches on

nits:
- correct spelling errors in `CompatibilitySwitch`
- take VS suggestions, mostly in test code
- rename methods in `ControllerBinderDelegateProviderTest` to match current API
- slightly refactor in `ApiBehaviorApplicationModelProvider`
2018-03-26 12:29:04 -07:00
Ryan Nowak 14429721d9 Make handler selector more flexible
Some details of this pending discussion, but this is a new 2.1 change
and compatibility switch in the spirit of making pages handler selection
less error-prone.

In particular we don't want anyone to have to define HEAD to do the
trivial thing. This currently routes all 'safe' HTTP methods to the GET
handler and all other HTTP methods to the POST handler.

This is technically not the correct thing to do for OPTIONS and TRACE,
so we might still do something different.

The tests will change a little depending on exactly what we decide to
do, but this is the main idea of the change.
2018-03-23 14:22:48 -07:00
Pranav K ccb6793126
Introduce LifecycleProperty
Update TempDataAttribute infrastructure to use LifecycleProperty
2018-03-22 10:18:36 -07:00
Kiran Challa e2b6975bff Marked PageArgumentBinder type as Obsolete 2018-03-19 11:50:20 -07:00
Kiran Challa a0b1b15101 [Fixes #7412] AspNetCore 2.1 breaks integration with 3rd party validation libraries 2018-03-13 02:07:56 -07:00
N. Taylor Mullen 43106f688a Re-enable "Move to RazorProjectEngine."
- This was initially reverted due to insufficient packages for local builds.

This reverts commit 5ac6fa77f8.
2018-02-16 16:13:54 -08:00
N. Taylor Mullen 5ac6fa77f8 Revert "Move to RazorProjectEngine."
- Waiting for packages to be available from Razor.

This reverts commit 608330dc86.
2018-02-15 17:01:07 -08:00
N. Taylor Mullen 608330dc86 Move to RazorProjectEngine.
- Updated our consumption of `RazorEngine` and `RazorTemplateEngine` to use `RazorProjectEngine` and its features.
- Updated service registrations to maintain existing services but to also register new ones.
- When moving `RazorViewEngine` to use `RazorProjectFileSystem` I had to add an unused constructor item in order to disambiguate the constructors.
- Updated tests to use `RazorProjectEngine` and `RazorProjectFileSystem`.

#7377
2018-02-15 16:34:26 -08:00
Pranav K 06e40252a0 Add support for top level validation to Razor Pages 2018-02-14 14:39:25 -08:00
Pranav K dbff416be6 Add support for running conventions on controller properties, Razor Page parameter and properties
Fixes #6935
2018-01-29 11:43:25 -08:00
Javier Calvarro Nelson 7127bb5dbb Add DeclaredModelType to Razor pages
* This allows razor pages to override their model type with a model that
  extends the declared model type through the page application model.
2018-01-25 16:00:54 -08:00
Pranav K f0ae0ce528 Add PageConvention overloads for areas
Fixes #7246
2018-01-18 08:21:21 -08:00
Pranav K 946b64143e Allow override routes on Pages
Fixes #6605
2018-01-12 15:57:13 -08:00
Pranav K 094b61dfc6 Refactor PageRouteModel generation 2018-01-12 15:44:23 -08:00
Kiran Challa c922b0b90d Improving logging - model binding
Related to issue #6498: When enabling "Trace" logging for MVC loggers, I should be buried in log messages
2018-01-11 14:51:53 -08:00
Ajay Bhargav Baaskaran b20e35e76a Set RelativePhysicalPath in FileProviderRazorProjectItem 2018-01-11 13:20:17 -08:00
Doug Bunting afc75a8296 Move `IHttpRequestStreamReaderFactory` from `.Internal` to `.Infrastructure`
- #7044
- move `IHttpResponseStreamWriterFactory` too
- add breaking change records e.g. for changes to `BodyModelBinder[Provider]` constructors
  - these changes relate to previously-"internal" constructors and one property

nits: take VS suggestions for changed files
2018-01-09 10:51:09 -08:00
Ryan Nowak d58d0f917f Add support for recompilation 2018-01-08 15:26:20 -08:00
Pranav K 7d64990a69 Ensure RazorPages in an area are not route-able through root based paths when root directory and area root directory overlap
Fixes #7147
2018-01-03 09:37:30 -08:00
Ryan Nowak 64259fe51c Add skips for dotnet/standard#567
This issue causes problems with ValueTuple when used across assembly
boundaries between netstandard and net4X when net471 is installed. These
tests fail consistently in appveyor and will fail on any machine with
net471 installed.
2018-01-02 20:58:39 -08:00
Ryan Nowak 49bdcfb150 Updated Razor Pages areas for compatibility switches 2018-01-02 09:48:23 -08:00
Pranav K dfa085afaf Add support for areas to Razor Pages
Fixes #6926
2017-12-19 15:03:05 -08:00
Kiran Challa c8cabde1f1 Improve logging - individual filters 2017-12-18 13:16:06 -08:00
Kiran Challa 4c4a7b3c6c Improve logging - filter pipeline execution
Related to issue #6498: When enabling "Trace" logging for MVC loggers, I should be buried in log messages
2017-12-14 11:22:13 -08:00
Pranav K 41efa409a4 Remove TestOptionsManager 2017-10-30 17:49:15 -07:00
Pranav K 197ef139d6 Provide a way within the Page/PageModel to run code before any handler runs
Fixes #6606
2017-09-22 09:25:22 -07:00
Steve Sanderson 236ef5d1d1 Support validation and BindBehavior on top-level action parameters and bound properties. Fixes #6790 2017-09-22 10:13:48 +01:00
Pranav K de38922601 Allow BindPropertyAttribute to be applied on PageModel
Fixes #6653
2017-09-12 10:34:19 -07:00
Pranav K 6bf165f22f Update default Razor search paths to include ~/[PagesRoot]/Shared
Fixes #6604
2017-09-11 14:11:39 -07:00
Pranav K bac68ba3c2 Injecting IViewLocalizer into Razor Page causing IndexOutOfRangeException
Fixes #6694
2017-09-06 13:54:38 -07:00
bchavez 16c267d95e House Cleaning - Spelling and grammar 🚿 2017-08-30 14:58:44 -07:00
Pranav K b82200851f Do not re-discover runtime compiled RazorPage files for precompiled Razor Pages.
Fixes #6718
2017-08-29 16:15:07 -07:00
Pranav K 900a5c7c4c Add support for ResponseCache in Razor Pages
Fixes #6437
2017-08-18 16:25:40 -07:00
Pranav K 2ef26486dd Add global filters with the right scope
Previously global filters were added to the page application model with Action scope. This
would have resulted in incorrect ordering of filters during execution. We'll instead add
global filters separately with the right scope. #6579 will be used to express global filters
as part of the application model.
2017-07-21 14:02:07 -07:00
Pranav K 998547839e Ensure IPageApplicationModelProviders are invoked in the sequence of their Order
Fixes #6536
2017-07-14 10:11:53 -07:00
Ryan Nowak 8d9c16132a Fix #6479 - remove IFileProvider constructor
The RazorProject implementation used by MVC at runtime has a constructor
that takes an IFileProvider (used by tests). This causes ambiguities
when a user registers an IFileProvider in DI.

Cleaning up tests to use a mock instead of the file provider directly
2017-07-04 13:48:56 -07:00
Pranav K bc86ea4e47 Move convention extensions from RazorPagesOptions to PageConventionCollectionsExtensions
Fixes #6462
2017-06-30 14:25:10 -07:00
Ryan Nowak 579aca0121 Define semantics for pagemodels
Fixes #6210

Now a pagemodel requires a [PageModel] somewhere in it's hierarchy. We
don't do a guess at whether or not your model class is a PageModel.
2017-06-29 09:24:57 -07:00
Pranav K 8df3032540 Add support for specifying filters on page models.
Fixes #6334
2017-06-28 14:43:02 -07:00
Ryan Nowak 1886d53d89 Remove [BindProperty] on class
This isn't a good fit with consistency with controllers. Discussed with
@DamianEdwards and we agreed to remove this for now and bring it back in
the future if there's a real need for it.
2017-06-28 08:18:42 -07:00
Pranav K 9acfc8d221 Watch _ViewImports outside the pages root for changes
Fixes #6428
2017-06-27 09:30:07 -07:00
Pranav K d1813a7cd7 Normalize paths returned by view location expanders
Fixes #6448
2017-06-27 08:48:07 -07:00
Ryan Nowak 0ad9c7d4eb Making Pages Binding Consistent
This changeset reckonciles the binding work we did for pages with
controllers.

A quick summary:
- Moves [BindProperty] to the MVC namespace (#6401)
- Makes [FromRoute] and friends behave consistently (#6402)
- Makes [BindProperty] work with controllers (untracked)
2017-06-26 18:11:44 -07:00
Pranav K aa5a348385 _ViewStart.cshtml not picked up when added to the root of the app
Fixes #6308
2017-06-23 08:25:58 -07:00
Pranav K 0dfffd45c2 RazorPages page directives missing quotes should alert user
Fixes #5868
2017-06-22 15:13:38 -07:00
Ryan Nowak dfe04bc917 Fix #5979 - Remove hardcoding of tempdata for pages 2017-06-12 15:05:36 -07:00
Pranav K 6961cf9211 Cleanup unused precompilation code 2017-06-09 16:45:43 -07:00
Pranav K 8f883e8e13 Use RazorViewAttribute \ RazorPageAttribute for view discovery 2017-06-07 13:49:24 -07:00