Commit Graph

75 Commits

Author SHA1 Message Date
Ryan Nowak 229724c4ea Reorganize MVC namespaces 2015-09-01 22:28:33 -07:00
Chris R f2db0d1483 React to string[] -> StringValues changes. 2015-08-28 16:36:19 -07:00
Ryan Nowak 1596cd9422 Fix #2527 - Remove FormCollection use
This removes the dependency on Microsoft.AspNet.Http from the Mvc.Core
code. Added the reference back to tests where needed (DefaultHttpContext).
2015-08-24 11:09:30 -07:00
Ryan Nowak 89a8d0e36c Remove IScopedInstance - use AsyncLocal for ActionContext and
ActionBindingContext

This change replaces IScopedInstance<T> in favor or IActionContextAccessor
and IActionBindingContextAccessor. In the spirit of IHttpContextAccessor,
these are both singletons which use AsyncLocal for storage.

This change allows the invoker factory to be cached which results in some
significant perf gains.
2015-08-13 15:58:29 -07:00
Doug Bunting 83a559c28c Add `ModelValidationNode`s consistently
- #2633
- do not leave `ModelBindingResult.ValidationNode` as `null` when we hit the `null` `RawValue` special case
 - move two bits of code together to make the special case more obvious
- add `ModelValidationNode` (that suppresses validation) when `HttpRequestMessageModelBinder` is successful
 - also suppress validation of `HttpRequestMEssage` properties
- suppress validation in `CancellationTokenModelBinder`, `FormCollectionModelBinder`, `FormCollectionModelBinder`
- do not create a `ModelValidationNode` when validation fails in `TypeConverterModelBinder`

nits:
- improve some doc comments
- add a quick `HttpRequestMessageModelBinderTest`
2015-08-11 08:30:29 -07:00
Doug Bunting 6106375306 Add `HttpOkResult`, `HttpOkObjectResult`, and `Ok()` methods in `Controller`
- #2825
- new class names align with existing types such as `HttpNotFoundResult` and `HttpNotFoundObjectResult`
- remove similar types from WebApiCompatShim and use replacements in `ApiController`
 - `NegotiatedContentResult<T>` remains because Core doesn't have an exact replacement

nits:
- add missing periods in some `Controller` doc comments
2015-07-23 18:49:36 -07:00
Ryan Nowak 0b50bfe03c Move Moq to framework-specific dependencies
New builds of dnu/VS are complaining about this.
2015-07-13 16:12:09 -07:00
Ryan Nowak ccb2f2deda React to move of StatusCodes 2015-07-08 12:43:33 -07:00
Ryan Nowak 950b8b41a8 Rename IFilter -> IFilterMetadata 2015-07-06 23:40:43 -07:00
sornaks 68523a3550 Fixing tests in Mono.
- Disabling tests which have corresponding bugs in mono.
- Fixing a few tests which do not handle *nix file system.
- Updating Travis configuration to use mono's alpha bits.
- Introducing PlatformNormalizer to normalize content across multiple platforms.
2015-07-02 17:24:14 -07:00
Ajay Bhargav Baaskaran e2787b3b84 [Fixes #2715] Removed formatter dependency from JsonResult and JsonViewComponentResult 2015-06-25 14:09:32 -07:00
Ryan Nowak a679e87a9b Split Mvc.Core
This is the first step is some more refactorings to come in the future
with the goal of making MVC less monolythic. This makes the core of MVC
more reusable and more in line with the design of other vNext platform
components.

With this change, Mvc.Core contains just the minimal guts needed to build
a working app.
- Action Discovery
- Action Invoker
- Filters
- ObjectResult
- Model Metadata
- Model Binding
- Formatters
- Validation System

And yes, we are aware of the irony of 'minimal MVC' not including the view
system. The idea is that this is the kernel of an MVC app, and anything
real is layered on top.

The most noticable impact of this change is that MvcOptions has been blown
apart into more managable chunks. See the various ConfigureMvc*** methods.

The new Mvc.Extensions package is a placeholder while we evaluate and tune
the new definitions. Expect more changes as features are move to their own
packages, and in some case their own repositories.

For now there is no experience to bootstrap an Mvc.Core app. That's coming
next.
2015-06-09 02:12:13 -07:00
Ryan Nowak 6cd277e8aa Refactor I***ModelBuilder extensibility
Combining IControllerModelBuilder and IActionModelBuilder into a pipeline
of IApplicationModelBuilders. Extensibility for framework features (Auth,
Cors, etc) should implement an IApplicationModelBuilder to add data to
models before IApplicationModelConventions have a chance to run.

Also deleting IGlobalFilterProvider while touching this code, this should
have been removed a while ago when we removed other options facades.
2015-06-07 18:07:41 -07:00
Ryan Nowak 39fe063aee Fix #2330 - Reimagine *FormatterContext
This change simplifies InputFormatterContext/OutputFormatterContext by
swapping ActionContext for HttpContext.

This change is important especially for InputFormatterContext as it
decouples ModelState from ActionContext - allowing us to fix a
related bug where the _wrong_ ModelState can be passed in for a
TryUpdateModel operation.
2015-05-12 11:05:56 -07:00
Chris R bd03142dab React to Http namespace changes. 2015-05-07 15:19:10 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Henk Mollema 955b45f995 Utilized `nameof()` for `ArgumentNullException`s
Utilized the use of nameof() operator for ArgumentNullExceptions.
2015-04-24 14:00:34 -07:00
Chris Ross 6223aac9be Handle Http.Core rename. 2015-04-16 15:48:27 -07:00
Kiran Challa c3f10f4a0f Logging for content-negotiation 2015-04-16 12:02:55 -07:00
Kiran Challa 65bd8c448a Removed Logging related ILogValues types and cleaned up tests. 2015-04-16 11:19:20 -07:00
Kiran Challa 20daab2fb5 Removed direct dependency on Framework.Logging and instead used Framework.Logging.Interfaces.
Fixed breaking code which additionally cleans up start-up logging which we wanted to do.
2015-04-16 11:19:17 -07:00
Harsh Gupta 58a5ad2279 Adding Outputformatter in resource filters. 2015-04-08 16:46:46 -07:00
Pranav K f9d53e341c * Simplify MvcOptions
* Remove facades for accessing Options<T> and pass options to the invoker

Fixes #2266
Fixes #2269
2015-04-07 14:45:53 -07:00
Doug Bunting f3ec6f33ae Merge remote-tracking branch 'origin/release' into dev 2015-04-03 12:08:11 -07:00
Doug Bunting 7916cb9c68 Add a few more `<Service/>` items 2015-04-02 22:55:21 -07:00
Doug Bunting 393aa54545 Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename 2015-04-02 13:49:27 -07:00
N. Taylor Mullen 2de7c173ab Add travis and appveyor CI support. 2015-04-01 15:53:39 -07:00
Doug Bunting 4d4686147f Let VS do its thing
- newline after BOM and slight reordering of Mvc.sln
- add `Service/Include` properties to some test .xproj files
 - also add BOM in a few cases
2015-03-28 14:41:40 -07:00
Harsh Gupta ac908d405e Removing ModelMetadataProvider.GetModelMetadataForParameters 2015-03-19 16:42:54 -07:00
N. Taylor Mullen 385fa29407 Update xunit.runner.kre => xunit.runner.aspnet. 2015-03-12 18:01:41 -07:00
N. Taylor Mullen c1a026cbf7 Update .kproj => .xproj. 2015-03-11 14:01:43 -07:00
N. Taylor Mullen 1d578ca2fd Remove BOM from project.json, *.cmd, *.sh and *.shade files. 2015-03-09 12:56:42 -07:00
N. Taylor Mullen e829ba7646 Update aspnet50/aspnetcore50 => dnx451/dnxcore50. 2015-03-08 12:52:24 -07:00
Pranav K ed3f5118e3 Reacting to NullLoggerFactory removal 2015-02-26 17:52:50 -08:00
Yishai Galatzer ed8e5716ea Remove INestedProviderXXX
React to aspnet/DependencyInjection#179
2015-02-23 15:18:39 -08:00
Hao Kung 94ef6cf8fa React to Authorize changes 2015-02-16 15:40:57 -08:00
Pranav K e1e43e1e8c ControllerActivator should be able to use controllers registered as
services

* Added WithControllersFromServiceProvider that replaces the default
  controller activator with a service based one.
* Move activation to DefaultControllerFactory
* Modify [Activate] behavior so that it no longer activates services. Use
  [FromService] attribute to hydrate services

Fixes #1707
2015-02-11 16:41:59 -08:00
Ajay Bhargav Baaskaran ac6a1a6a80 Replaced status code number with constants 2015-02-05 16:43:59 -08:00
Ryan Nowak 08a578d01f Issue #1525 - Enhancements to ActionContext
- Adding a new constructor that takes ModelState.
 - Removing an extra constructor that's not needed
 - docs
 - test cleanup
2015-01-27 14:35:31 -08:00
Ryan Nowak 0c5a702245 Changing when controllers are created
This change moves controller creation to the stage immediately before
model binding. The controller will be disposed/released before Resource
Filters run their 'OnResourceExecuted' method. Previously the controller's
lifetime surrounded all filter invocation.

Additionally, the Controller property is now gone from ActionContext, and
is moved to the 4 filter contexts that should have access to it
Action*Context and Result*Context.
2015-01-16 20:23:39 -08:00
Kiran Challa 02f4ca9f05 [Fixes #1791]Remove XML formatter from defaults 2015-01-15 15:46:49 -08:00
Chris Ross 9aff289dfe Handle PipelineCore rename. 2015-01-15 15:25:17 -08:00
Doug Bunting 6df288bce7 Correct StyleCop violations
- StyleCop working again (handles C# 6.0 additions) though only locally for me
- disable some new rules:
 - ConstFieldNamesMustBeginWithUpperCaseLetter
 - InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements
 - StaticReadonlyElementsMustAppearBeforeStaticNonReadonlyElements
 - StaticReadonlyFieldsMustBeginWithUpperCaseLetter
 - PrefixCallsCorrectly
- correct remaining violations
 - lots of long lines for example
 - use more `var`; some manual updates since StyleCop doesn't check seemingly-unused blocks

nit: remove new trailing whitespace (was paranoid about adding it w/ fixes)
2015-01-06 16:23:57 -08:00
Ryan Nowak 0a473b0600 Remove ParameterModel.IsOptional
The ParameterModel and ParameterDescriptor have had a notion of
optionality for a while now, even though all parameters are treated as
'optional' in MVC.

This change removes these settings. Optionality for overloading in webapi
compat shim is reimplemented via a new binder metadata.
2015-01-06 15:22:13 -08:00
Ajay Bhargav Baaskaran 51567194dc deleted duplicate action results in WebapiCompatShim 2015-01-06 11:07:22 -08:00
Kiran Challa 391816eb71 [Fixes #1713]WebApiCompatShim doesn't work with Transfer Encoding: chunked 2015-01-05 21:52:13 -08:00
SonjaKhan c936ae80ca Logging assemblies, controllers, and actions 2014-12-18 10:52:20 -08:00
Pranav K 22ac7c45e5 Update Mvc to use official xunit runner 2014-12-17 11:27:07 -08:00
Yishai Galatzer 2eef4dd3cf Remove ControllerDescriptor and fix ControllerActionDescriptor to pick the right type for the display name. 2014-11-25 13:54:57 -08:00
Victor Hurdugaci 99b5f430ff Add schema version to kproj files 2014-11-25 10:57:58 -08:00