Commit Graph

2512 Commits

Author SHA1 Message Date
jacalvar 357f4a00b7 [Fixes #3952] ViewComponentDescriptor.Type should be a TypeInfo instance instead of a Type instance 2016-01-26 16:01:58 -08:00
jacalvar 354400f12b [Fixes #3752] Refactor and cleanup view components
* Moved instantiation of view components into DefaultViewComponentActivator
* Introduced IViewComponentFactory to handling setup of new view component instances.
* Added a release method on IViewComponentActivator for handling tear down of view
  component instances.
2016-01-26 14:18:12 -08:00
jacalvar 2b0bea675e [Fixes #3752] Cleanup Controller invocation pipeline
* Added a Release method to IControllerActivator
* Changed Create in IControllerActivator to take in a ControllerActionContext
* Move the check to determine if a controller can be instantiated into the controller activator.
* Move logic for disposing controllers into the controller activator and make release on the
  controller factory delegate into the activator.
* Changed release methods to take in a controller context.
2016-01-26 14:15:03 -08:00
N. Taylor Mullen e952009b09 Fix broken test.
- `ViewBuffer.Pages` is now initialized on `ViewBuffer` construction.
2016-01-26 12:00:25 -08:00
Doug Bunting 7446cec516 Update `TagHelperSampleTest` to avoid failures due to statefulness of the service
- have one test muted at the moment in our CI
- add `Reset()` action to the service, enabling `// Arrange` to bring `Index()` content to a known state
  - add a couple more tests to `TagHelperSampleTest` covering the new action and empty `Index()` list

nits:
- use `ViewData`, not `ViewBag`
2016-01-26 10:50:51 -08:00
Pavel Krymets 79eb0138c7 Migrate to using System.Runtime.Loader.AssemblyLoadContext 2016-01-26 10:22:25 -08:00
Doug Bunting 7dddd06a38 Add more tests of `TagBuilder.CreateSanitizedId()`
- investigating #3951
2016-01-25 21:58:39 -08:00
N. Taylor Mullen a47dd7ad63 Fix design time line mapping Razor Host tests. 2016-01-25 17:39:10 -08:00
Pranav K f9ad93c8a5 Fixing XML docs 2016-01-25 16:08:04 -08:00
N. Taylor Mullen 6a43c420b6 Remove unneeded project.json 2016-01-25 15:48:03 -08:00
N. Taylor Mullen 964e58723c Revert "Try out a Karma test or two"
This reverts commit d696f268f7.
2016-01-25 15:35:54 -08:00
N. Taylor Mullen 1f77aa445a Fix XML docs to pass xml-docs-test. 2016-01-25 14:55:42 -08:00
Ryan Nowak 434da683fc Improve buffering of Razor output in MVC
These changes are aimed at significantly improving the performance of
MVC/Razor when a large amount of content is in play or a large number of
TagHelpers are used.

A few issues addressed:

- Buffer sync writes after a flush has occurred so that we can write them
  asyncronously. The issue is that an IHtmlContent can only do sync
  writes. This is very bad for Kestrel in general. Doing these writes
  async is better for our overall perf, and the buffer that we use for it
  is from the pool.

- 'Flatten' ViewBuffers when possible. A page with lots of TagHelpers can
  end up renting a ViewBuffer and only write 2-3 things into it. When a
  ViewBuffer sees another ViewBuffer we can either steal its pages, or
  copy data out and 'return' its pages. This lets us use 3-4 buffers for a
  large Razor page instead of hundreds.
2016-01-25 12:40:52 -08:00
Pranav K 6f885c7113 Adding empty project.json to unblock build 2016-01-25 12:11:50 -08:00
Pranav K 43b65ca46c Update the documentation for IViewComponentHelper.InvokeAsync
Fixes #3974
2016-01-25 12:05:28 -08:00
Doug Bunting d696f268f7 Try out a Karma test or two
- #1993
2016-01-25 10:50:32 -08:00
Ryan Nowak 8b1bd343ba Internal cleanup in ViewFeatures 2016-01-24 22:13:29 -08:00
Ryan Nowak de3b33caf1 Internal cleanup in Razor 2016-01-24 21:50:33 -08:00
Ryan Nowak a276169693 Reorganize logging, move more types to internal 2016-01-24 17:24:34 -08:00
N. Taylor Mullen 72d1c49575 Update missing AspNetCore referrences. 2016-01-22 16:48:47 -08:00
N. Taylor Mullen 25eb50120e Update ASP.NET 5 versions for ASP.NET Core.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:40:26 -08:00
N. Taylor Mullen 3be7fbdf9f Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:18:33 -08:00
N. Taylor Mullen 6a6c8ca544 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:17:07 -08:00
Pranav K 00462abe62 Cleaning up VirtualFileResult tests 2016-01-21 17:56:29 -08:00
Brennan 8765a06b69 React to Fileprovider namespace changes 2016-01-21 17:45:06 -08:00
Ajay Bhargav Baaskaran a47a7fdccc Added caching for ActionConstraints 2016-01-21 17:30:08 -08:00
Ajay Bhargav Baaskaran f0777b95a8 [Fixes #3868] Exclude Antiforgery token in form with method Get 2016-01-21 11:29:41 -08:00
Ryan Nowak dd952d8d70 Move some types to .Internal namespace 2016-01-21 10:56:38 -08:00
Kristian Hellang 6737a1f243 Adding params overloads for AddControllersAsServices
- Moved null checks
- Tweaked XML docs
2016-01-21 10:26:38 -08:00
Doug Bunting 04453a2b4f Support user overrides of three more framework-provided `ModelState`-related messages
- #3215
- add new accessor properties to `IModelBindingMessageProvider` and plumb them through
  - use in `ModelStateDictionary` when handling a `FormatException` or `OverflowException`
  - use in `ValidationHelpers` when handling a `ModelError` with `null` `ErrorMessage`
- add new `ModelExplorer` parameter to `IHtmlGenerator.GenerateValidationMessage()`
  - plumb through to `ValidationHelpers.GetModelErrorMessageOrDefault()`

Started from work @kichalla did on the `kiran/movemessages-to-messageprovider` branch in #3775.

nits:
- use helper methods more consistently in `HtmlHelper<T>`; slightly improves error checking
- remove unused `Resources` class from `Microsoft.AspNet.Mvc`
- make `ValidationHelpers` class `public`; already in `.Internal` namespace
  - split `GetUserErrorMessageOrDefault()` in two; rename to `GetModelErrorMessageOrDefault()`
- fix some #YOLO wrapping
2016-01-20 21:14:33 -08:00
Pranav K 1144fc0e6c React to System.Runtime.Loader TFM changes 2016-01-20 16:02:10 -08:00
Derek Gray 328f4d648b Allow ValidationAttributes and IValidatableObjects to resolve services from the RequestServices provider by injecting it into the ValidationContext. 2016-01-20 09:19:24 -08:00
ryanbrandenburg a229b20c48 * StringOutput set proper ContentType 2016-01-19 10:06:30 -08:00
Doug Bunting 2810858905 Add `HtmlEncoder` parameter to `RazorPage.StartTagHelperWritingScope()`
- aspnet/Razor#643 part 2: react to aspnet/Razor#653
 - change test calls and delegates to include new parameter
 - add tests specifically of the new feature
 - add tag helpers using new feature to `TagHelpersTest` functional test
- note `HtmlEncoder`s used elsewhere e.g. in other `RazorPage` instances are unaffected
 - i.e. changing one `RazorPage.HtmlEncoder` property only affects C# expressions in that page

Also simplify scope management, removing bizarre assertion when user does something odd.

nits:
- correct `// Act` and `//  Act & Assert` content
- remove #YOLO wrapping
2016-01-17 22:59:59 -08:00
John Luo 249673f2bc Reacting to hosting rename 2016-01-17 18:13:26 -08:00
Pranav K 2baafc3699 Specify Newtonsoft.Json version to ViewFeatures to sort out disambiguity. 2016-01-15 16:13:32 -08:00
Pranav K cf9221df07 Pool JsonSerializer instances
Fixes #3550
2016-01-15 16:13:31 -08:00
Doug Bunting fa8c2eac3e Check encoded and unencoded values against element body in `OptionTagHelper`
- #3386
- initialize comparison `HashSet` with unencoded values to ensure both are checked
- address perf and correctness issues in this code
  - `context.Items[typeof(SelectTagHelper)]` entry read as `ICollection` but written as `IReadOnlyCollection`
    - `IReadOnlyCollection` worse because it does not include `Contains()`, causing Linq use
  - every `<option>` element recalculated the encoded values and created a `HashSet` to contain them
    - add `CurrentValues` type to cache this `HashSet` in `context.Items`
  - each `OptionTagHelper` created the additional `HashSet` even if `Value` was bound
2016-01-14 17:46:54 -08:00
jacalvar 82381d97c2 [Fixes #3907] Improve MVC error when MVC services aren't registered 2016-01-14 15:09:07 -08:00
Pranav K c7f6ed4445 Removing Newtonsoft.Json dependency from Microsoft.AspNet.Mvc.Formatters.Json 2016-01-14 14:40:52 -08:00
Ajay Bhargav Baaskaran 30ddf9b969 Updated missed TimestampToTicks changes 2016-01-14 12:42:31 -08:00
Ben Adams 63a7d50dd1 Invert TimestampToTicks division 2016-01-14 12:20:59 -08:00
Pranav K 13c7e68fa7 Fix incorrect xml docs for RoslynCompilationService
Fixes #3384
2016-01-14 12:15:48 -08:00
Pranav K 200fb23ba5 Reduce allocations in GlobbingUrlBuilder 2016-01-14 12:15:41 -08:00
Pranav K e078259547 Modify UrlHelper to use a single StringBuilder 2016-01-14 10:39:35 -08:00
Pranav K aa5a4d4af2 Revert "Revert DependencyContext changes untill dotnet-cli packages get sorted out"
This reverts commit 57bf12311b.
2016-01-13 16:24:33 -08:00
Ryan Nowak 420f442487 Fixes #3818 - Support Consumes in ApiExplorer
This change adds a list of ApiRequestFormat objects to ApiDescription
object which include the content type and formatter for each supported
content type which can be understood by the action.

Computation is aware of the [Consumes] attribute via the
IApiRequestMetadataProvider metadata interface, and aware of Input
Formatters via the new IApiRequestFormatMetadataProvider interface.

This algorithm is essentially the same as what we do for
produces/output-formatters. We iterate the filters and ask them what
content types they think are supported. Then we cross check that list with
the formatters, and ask them which from that list are supported. If no
[Consumes] filters are used, the formatters will include everything they
support by default.

This feature and data is only available when an action has a [FromBody]
parameter, which will naturally exclude actions that handle GET or DELETE
and don't process the body.
2016-01-13 12:32:17 -08:00
John Luo 32bb324886 Removing redundant null logger after hosting fix 2016-01-13 12:14:38 -08:00
Ryan Nowak 70cee90186 Add optional filter caching 2016-01-13 09:11:08 -08:00
John Luo c5cab7a786 Reacting to hosting API changes 2016-01-12 18:07:17 -08:00