Commit Graph

155 Commits

Author SHA1 Message Date
Ryan Nowak ab3e0f953e
Makes RouteName => endpoint name for MVC (#9721)
* Makes RouteName => endpoint name for MVC

* feedback
2019-04-24 15:13:30 -07:00
dotnet-maestro[bot] 8eb2e8baec
[master] Update dependencies from dotnet/arcade (#9715)
* Update dependencies from https://github.com/dotnet/arcade build 20190423.2

- Microsoft.DotNet.GenAPI - 1.0.0-beta.19223.2

* Adjust to GenApi change in `enum` ordering
- was sorted by name, now by value
2019-04-24 19:21:37 +00:00
Ryan Nowak 6a99743d33 Fixes: #7611 - return convention builders for MVC
Adds support for returning convention builders from the various MVC
endpoint routing methods.

The fallback methods are excluded because the fallback endpoint doesn't
actually get executed.
2019-04-24 11:03:38 -07:00
Doug Bunting 1c19e8ee89
Merge branch 'release/2.2' -> 'master' (#9591) 2019-04-22 11:12:35 -07:00
Pranav K 418f3d82dd
React to new System.Text.Json features (#9572) 2019-04-21 20:48:41 -07:00
Pranav K 5e953124e6
Add support for System.Text.Json based JsonResult executor (#9558)
Fixes https://github.com/aspnet/AspNetCore/issues/9554
2019-04-21 09:13:30 -07:00
Doug Bunting dfae19ee7c
Merge branch 'release/2.2' -> 'master' 2019-04-19 18:53:15 -07:00
Ben Adams d46388b58e Lazy create MVC ControllerActionInvoker statemachines (#9533)
* Lazy create ControllerActionInvoker.InvokeInnerFilterAsync statemachine

* Lazy create ControllerActionInvoker.InvokeNextActionFilterAwaitedAsync statemachine

* Lazy create ControllerActionInvoker.InvokeNextActionFilterAsync statemachine

* Lazy create ControllerActionInvoker.InvokeActionMethodAsync statemachine

* Lazy create Controller.OnActionExecutionAsync statemachine

* Ref assembly

* Formatting feedback
2019-04-19 07:48:26 -07:00
James Newton-King 7669cf0d03
Move Microsoft.AspNetCore.Authorization.Policy types (#9492) 2019-04-19 13:24:36 +12:00
Pranav K 92cae6faab
Buffer writes from sources of synchronous writes (#9015)
* Buffer writes from sources of synchronous writes

Fixes https://github.com/aspnet/AspNetCore/issues/6397
2019-04-17 18:11:07 -07:00
Ryan Nowak 6f305373ca Allow fallback to controller to use MatcherPolicy 2019-04-16 19:36:32 -07:00
Ryan Nowak 6eeda774ef Implement IEndpointSelectorPolicy for ConsumesMatcherPolicy 2019-04-16 19:36:32 -07:00
Pranav K 51028dd129
Remove use of IgnoreNullPropertyValueOnRead and ReaderOptions from JsonSerializerOptions (#9429)
Fixes https://github.com/aspnet/AspNetCore/issues/9406
2019-04-16 16:24:17 -07:00
Nate McMaster d004cf0f14
Merge branch 'release/2.1' into release/2.2 2019-04-15 16:42:07 -07:00
Pranav K 836964a653 Don't log action and page handler arguments above Trace level (#9227) 2019-04-15 13:29:07 -07:00
Ben Adams 1baeaaac36 Feedback 2019-04-14 17:55:16 -07:00
Ben Adams 70b02f8406 Lazy create ResourceInvoker.InvokeNextResourceFilterAwaitedAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams cfc22fe0df Lazy create ResourceInvoker.InvokeNextResultFilterAwaitedAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 8c97cbe6aa Lazy create ResourceInvoker.InvokeNextResultFilterAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 7393f264b0 Lazy create ResourceInvoker.InvokeResultFilters statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 0657a3ed1a Lazy create ResourceInvoker.InvokeAlwaysRunResultFilters statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 6039699afa Lazy create ResourceInvoker.InvokeNextExceptionFilterAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 1a7e606504 Lazy create ResourceInvoker.InvokeNextResourceFilter statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 8bb54fc22a Lazy create ResourceInvoker.InvokeResultAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 305249709c Lazy create ResourceInvoker.InvokeFilterPipelineAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams fe6907616b Lazy create ResourceInvoker.InvokeAsync statemachine 2019-04-14 17:55:16 -07:00
Ben Adams 7a4400e3b2 ResourceInvoker faster task completion check 2019-04-14 17:55:16 -07:00
Pranav K b93bc433db
Make AuthorizeFilter work in endpoint routing (#9099)
* Make AuthorizeFilter work in endpoint routing

Fixes https://github.com/aspnet/AspNetCore/issues/8387
2019-04-08 06:03:34 -07:00
Ryan Nowak 258d34e382
Use coventional routes for link generation (#9037)
Use coventional routes for link generation

This change enables using conventional routes for link generation when
using MVC conventional routes. This change makes MVC link generation
behaviour highly compatible with 2.1.

The way that this works is that we create endpoints for **MATCHING**
using the denormalized conventional route, but we tell those endpoints
to suppress link generation.

For link generation we generate a non-matching endpoints per-route with
the same order value.

I added the concept of *required value any* to link generation. This is
needed because for an endpoint to participate in link generation using
RouteValuesAddress it needs to have some required values. These details
are a little fiddly, but I think it's worth doing this feature
completely.
2019-04-05 08:31:10 -07:00
Ryan Nowak 284e968101 Add AddControllers and AddRazorPages
These are *new style* for configuring MVC in services. We're adding these to make
things feel a bit more tailored to those particular scenarios.

----

The main reason for this is that we've had repeated community asks for an
*API-optimized* way of configuring MVC. I don't think that using AddMvcCore
is a suitable building block, because it has too many options that you want.

I've think I've identified the reasonable set of features that should be part
of the default experience for APIs. All of these things are already pay-for-play
and are activated by the presence of attributes. The only additional cost is
loading of assemblies and a few additional inspections of the attributes
(cached).

----

Additionally the AddControllers experience is composible. You can add views
to it, or add pages and get the whole thing.

AddRazorPages is basically an alias for what AddMvc does today. We don't
currently have a way to add pages without controllers (the opposite is true).
Based on feedback we could specialize this more.

----

Branding and perception are important, and we've users ask for more flexibility
in what gets added. The plan is to update the templates to use this experience
in preview4, and see what kind of feedback we get.
2019-03-29 18:51:10 -07:00
Ryan Nowak 658b37d2bd
Make UseEndpoints a thing (#8765)
* Make endpoint middleware explicit

This change makes the endpoint middleware explicit again, and updates
all of the templates.

The other change here is make UseEndpoints be the place where you
register endpoints. This is vital because it puts your code visually at
the point of the pipeline where it executes.

Lastly, I removed support for UseMvc with endpoint routing. This is
causing issues for some security features, and we're moving in the
direction of trying to make the middleware heavy implementation required
in 3.0. There are some issues we won't be able to fix in MVC if we can't
unambiguously know if UseMvc was used or the middleware.
2019-03-28 15:41:11 -07:00
Ryan Brandenburg 70cd5f5f9f
Mark tests flaky instead of skipped (#8727)
Mark tests flaky instead of skipped
2019-03-26 09:51:37 -07:00
Pranav K f5ff181222
System.Text.Json based formatters (#8362)
* System.Text.Json based formatters

Fixes: https://github.com/aspnet/AspNetCore/issues/7256
2019-03-21 13:45:21 -07:00
Chirag Rupani aa89639d62 Removed Content Type header for response when no content is being returned (#8557)
Addresses #8230
2019-03-20 13:15:42 -07:00
James Newton-King 47fab927a1
Add friendly error message to UrlHelper for when there is no IRouter (#8145) 2019-03-15 10:14:07 -07:00
Ryan Nowak 4b4614635f Change template -> pattern for MVC 2019-03-13 20:12:53 -07:00
Ryan Nowak e78a6521b9 Make naming of IEndpointRouteBuilderConsistent across usages. 2019-03-13 20:12:53 -07:00
Pranav K 0d10c49823
Make IApiBehaviorMetadata public (#8410)
Fixes https://github.com/aspnet/AspNetCore/issues/8403

The analyzer expects the type to be present. However since it's listed
as internal, it is not present when compiling against the ref assembly \ targeting pack.

It was left as internal so we could evolve it later, but we haven't found a need for it as yet.
2019-03-11 14:25:45 -07:00
Pranav K 41e6fc8ab0 Use ApplicationPartFactory when adding application parts
Fixes https://github.com/aspnet/AspNetCore/issues/8288
2019-03-07 13:38:31 -08:00
Ryan Nowak a1ec03e1e6 Add fallback routing for controllers and pages 2019-03-06 09:48:07 -08:00
Ryan Nowak bb28db6fb2 Generalize Action Selection logic
Allows us to use the "select action via route values" logic for
endpoints.
2019-03-06 09:48:07 -08:00
Jeremy Lawrence a1f544b62f Correct doc comment for ApiConventionTypeMatchBehavior (#7861) 2019-03-05 14:43:59 -08:00
shnja 4c3996f824 Use Request.Scheme instead of Protocol (#7911) 2019-03-05 14:39:37 -08:00
Ryan Brandenburg 414d8a514f
Add missing doc comments (#8035) 2019-03-05 10:01:20 -08:00
Pranav K f79f2e3b12
Add some reference docs for MVC (#7981) 2019-02-28 09:56:55 -08:00
Pavel Krymets 9355c7c1a5
Add reference assemblies support (#7764) 2019-02-21 14:33:35 -08:00
Chris Ross 4e44025a52
Replace IHostingEnvironment with IWebHostEnvironment (#7725) 2019-02-19 21:11:52 -08:00
Matthias Laroche 7af971838e Set Content-Length to 0, when returning an empty body
When returning 416 RangeNotSatisfiable in FileResultExecutorBase, set the Content-Length based on the length of the body instead of the length of the original file.
Bugfix for  :
https://github.com/aspnet/AspNetCore/issues/4943
2019-02-19 17:54:11 -08:00
Matthias Laroche 134f28f71d Update FileResult tests to detect a bug for the status 416 RangeNotSatisfiable
Update FileResult tests to detect a bug for the status 416 RangeNotSatisfiable :
https://github.com/aspnet/AspNetCore/issues/4943
When the body is empty, the Content-Length header should be 0 to match the body length.
2019-02-19 17:54:11 -08:00
Doug Bunting 14b7184c09
Improve documentation of `BinderType` and `BindingSource` properties (#7218)
- add regression test for #4939
- add `[BindProperty]` doc comments
- add `<remarks>` to `BinderType` properties that recommend setting `BindingSource` in some cases

smaller issues:
- catch invalid `BinderType` values up front
- complete `BindingSource.ModelBinding` implementation: `IValueProvider` filtering was faulty

nits:
- accept VS suggestions e.g. remove unused variables
- "model binder" -> `<see cref="IModelBinder" /> implementation` in some doc comments
2019-02-19 15:22:04 -08:00
Doug Bunting 3e0c75187c
Place limits on model binding collection size and recursion depth (#7214)
- #7052
- add MvcOptions.MaxModelBindingCollectionSize` and `MvcOptions.MaxModelBindingRecursionDepth`

nits:
- update syntax of a few `Resources.Designer.cs` files (I ran `/t:resx` on Mvc.sln)
- take VS suggestions in a few test classes
2019-02-19 15:17:56 -08:00
James Newton-King c2d1ab925e
Remove obsolete APIs from routing (#7371) 2019-02-16 18:37:51 +13:00
Ajay Bhargav Baaskaran 7a26d27e8b Merge branch 'release/2.2' 2019-02-14 16:08:51 -08:00
Ajay Bhargav Baaskaran 0c2ee920a1 Merge branch 'release/2.1' into release/2.2 2019-02-13 14:52:38 -08:00
Ajay Bhargav Baaskaran 4cceccd568
Make Mvc repo folder layout consistent (#7518) 2019-02-13 10:53:39 -08:00