Commit Graph

74 Commits

Author SHA1 Message Date
Pranav K d87d8283d0 Use latest build of dotnet-test-xunit 2016-04-19 14:54:07 -07:00
Pavel Krymets e6ffb060f7 Bring Microsoft.NETCore.Platforms dependency back 2016-04-18 17:20:15 -07:00
Pavel Krymets 42c3397b6e Migrate tests, tools and samples to portable 2016-04-18 17:20:15 -07:00
Ryan Nowak 3ec60a0181 Fix #4447 - Teach MVC to understand defaults
The wireup for defaults in attribute routes was missing
2016-04-11 14:38:29 -07:00
Pranav K c66c408c15 DefaultAssemblyPartDiscoveryProvider.IsCandidateLibrary should not look at types in Mvc assemblies
Fixes #4363
2016-04-06 08:41:12 -07:00
Kiran Challa cda1307848 Updated test to fix build break 2016-04-03 08:01:15 -07:00
Kiran Challa 4cd3012886 Fix mixed route for action error message 2016-04-03 06:55:11 -07:00
jacalvar f638c051fa Remove IAssemblyProvider and update DNX to work with application parts.
* Remove IAssemblyProvider.
* Remove DefaultAssemblyProvider in favor of DefaultAssemblyPartDiscoveryProvider.
* Update AddMvcDnx to add the list of DNX discovered assemblies to the list of application parts.
2016-04-01 11:01:09 -07:00
jacalvar 5246125cb7 [Fixes #4087] Add AddViewComponentsAsServices() and ServiceBasedViewComponentActivator
* Added ViewComponentFeture and ViewComponentFeatureProvider to perform view component discovery.
* Changed view component discovery to use application parts.
* Changed ViewComponentDescriptorProvider to make use of Application parts.
* Added AddViewComponentsAsServices method on IMvcBuilder that performs view component
  discovery through the ApplicationPartManager and registers those view components as
  services in the service collection. Assemblies should be added to the ApplicationPartManager
  in order to discover view components in them in them.
2016-04-01 10:55:04 -07:00
jacalvar 0d0aad41f5 [Fixes #4014] Add overload to AddControllerAsServices that uses the default controller discovery logic.
* Added ControllerFeature and ControllerFeatureProvider to perform controller discovery.
* Changed controller discovery to use application parts.
* Changed ControllerActionDescriptorProvider to make use of Application parts.
* Simplified AddControllerAsServices to not accept any parameter and perform
  controller discovery through the ApplicationPartManager in the IMvcBuilder
  and IMvcCoreBuilder. Assemblies should be added to the ApplicationPartManager
  in order to discover controllers in them.
2016-04-01 09:29:37 -07:00
Ryan Nowak 144766f2e3 Simplify BindAttribute - rename PredicateProvider
This change renames IPropertyBindingPredicateProvider to
IPropertyFilterProvider. The changes here are mostly renames of
parameters/variables from predicate -> propertyFilter. I did a
find+replace and left the term 'predicate' in some of the docs because it
refers to a predicate in the abstract sense.

This change also simplifies BindAttribute and removes support for type
activation.
2016-03-31 12:34:02 -07:00
jacalvar 1bd66ffda0 [Fixes #4089] Add support for application parts
This commit introduces application parts as a concept on MVC.

An application part is an abstraction that allows you to expose some
feature or corncern in a way that is decoupled from their underlying source.
Examples of this include types in an assembly, emdeded resources, files on
disk etc.

Application parts are configured during startup by adding or removing them from
the application part manager available as part of IMvcBuilder and IMvcCoreBuilder.

The application part manager provides the ability to populate features from the
list of available application parts by using a list of application feature providers.
Application feature providers are responsible for populating a given feature given a
list of application parts.

Examples of application providers can be a ControllerFeatureProvider
that goes through the list of application parts, sees which one of those parts exposes types,
determines which of those types are controller types, and adds them to a ControllerFeature
that holds a list of all the types that will be considered controllers in the application.
2016-03-31 12:14:04 -07:00
jacalvar de9ffb13c7 [Fixes #3732] Simplify controller discovery.
* Introduce ControllerAttribute and use it to mark base classes as controllers.
* Changed rules for controller discovery to:
  * All controller types must be public, concrete, non open generic types.
  * NotController attribute is not applied to any type oif the hierarchy.
  * The type name ends with controller.
  * Controller attribute is applied to the type or to one of its ancestors.
2016-03-31 10:50:26 -07:00
Doug Bunting 6bf25cecec React to HttpAbstractions namespace changes
- aspnet/HttpAbstractions#549 and aspnet/HttpAbstractions#592
- clean up `using`s
2016-03-30 16:19:42 -07:00
Ryan Nowak e1abb47b98 Fix #4238 IFormFile model binder suppresses validation
This change no longer suppresses validation for IFormFile and
IFormFileCollection model values. This will allow the use of [Required] on an
IFormFile model, or a custom attribute for validating IFormFileCollection.

These types already have ValidateChildren = false, so we don't recurse
into them.
2016-03-30 14:09:28 -07:00
Ryan Nowak fb81a5e11e Introducing ModelBinderFactory
This change separates model binding into IModelBinderProvider (decides
which binder to use) and IModelBinder (does binding). The
IModelBinderFactory is a new services with coordinates the creation of
model binders.
2016-03-29 15:45:14 -07:00
Pranav K 12d7093278 Revert "Remove DependencyModel dependency"
This reverts commit 4299a4d50b.
2016-03-29 07:29:43 -07:00
Pranav K 529fa67c2b Adding tests for PrefixContainer
Fixes #4045
2016-03-28 14:31:17 -07:00
Kévin Chalet f9d24a8521 Introduce SignInResult/SignOutResult and ControllerBase.SignIn/SignOut 2016-03-28 12:45:42 -07:00
David Fowler 5ddb17d2fe Fixed packages 2016-03-25 12:27:49 -07:00
Doug Bunting 43836aec18 An `ObjectPoolProvider` is always registered
- react to aspnet/Hosting/pull#673
2016-03-25 11:20:15 -07:00
Pranav K 06289945d0 Reacting to CoreCLR package changes 2016-03-22 14:49:43 -07:00
ryanbrandenburg a78f77afde Add StatusCode helpers to ControllerBase 2016-03-21 15:26:13 -07:00
Ajay Bhargav Baaskaran 8e6b4980e3 [Fixes #4310] Moved AuthorizeFilter and CorsAuthorizationFilter to a public namespace 2016-03-21 11:54:03 -07:00
mnltejaswini fd984563c3 [Perf] Optimize CoerceResultToTaskAsync to remove MethodInfo.Invoke 2016-03-17 16:12:55 -07:00
Pranav K f651f18d3a Use a prefix tree as a backing store for ModelStateDictionary 2016-03-17 10:09:36 -07:00
Pranav K 4299a4d50b Remove DependencyModel dependency 2016-03-16 16:05:04 -07:00
jacalvar cef81adb21 [Fixes #4237] Include Assembly-Qualified type name in ActionDescriptor.DisplayName 2016-03-16 15:26:25 -07:00
ryanbrandenburg 1ae1cdb10b * Remove ServiceProvider 2016-03-15 09:57:17 -07:00
mnltejaswini 007c47d065 [Perf] Optimize controller action invoke
Fixes aspnet/MVC#3903
2016-03-14 10:17:55 -07:00
Pranav K 4f709bdbfd Fixing CI build break 2016-03-14 00:38:17 -07:00
jacalvar 75df24e357 Added tests for HttpOptionsAttribute 2016-03-10 09:49:44 -08:00
Pranav K 5a7267a83d Revive DefaultAssemblyProviderTests
Partial fix for https://github.com/aspnet/Mvc/issues/4140
2016-03-07 17:01:58 -08:00
mnltejaswini d537ec06cc [Perf] Using single UrlHelper per HttpContext and one StringBuilder per UrlHelper to reduce allocations 2016-03-07 13:48:54 -08:00
Doug Bunting d3c24637b1 Correct `Type.IsAssignableFrom()` polarity
- #3482
 - see new tests; many failed without fixes in the product code
 - add support for binding `IFormFileCollection` properties
 - make `FormFileModelBinder` / `HeaderModelBinder` collection handling consistent w/ `GenericModelBinder`++
  - see also dupe bug #4129 which describes some of the prior inconsistencies
  - add checks around creating collections and leaving non-top-level collections `null` (not empty)
 - move smarts down to `ModelBindingHelper.GetCompatibleCollection<T>()` (was `ConvertValuesToCollectionType<T>()`)
  - add `ModelBindingHelper.CanGetCompatibleCollection()`
  - add fallback for cases like `public IEnumerable<T> Property { get; set; } = new T[0];`
- #4193
 - allow `Exception`s while activating collections to propagate
- part of #4181
 - `CollectionModelBinder` no longer creates an instance to check if it can create an instance
 - not a complete fix since it still creates unnecessary intermediate lists

nits:
- correct a few existing test names since nothing is not the same as `ModelBindingResult.Failed()`
- remove a couple of unnecessary `return` statements
- correct stale "optimized" comments
- explicit `(string)`
2016-03-03 09:55:01 -08:00
Doug Bunting b35922e373 Remove project name from output path
- aspnet/Coherence-Signed#187
- remove `<RootNamespace>` settings but maintain other unique aspects e.g. `<DnxInvisibleContent ... />`
- in a few cases, standardize on VS version `14.0` and not something more specific
2016-03-02 14:39:12 -08:00
N. Taylor Mullen 33d1aea8ea Transition to Netstandard.
- dotnet5.X => netstandard1.y (where y = x-1).
- DNXCore50 => netstandardapp1.5.
- Applied the same changes to ifdefs.
2016-03-01 13:39:31 -08:00
Kiran Challa b7cde3e58f [Fixes #4043] Figure out ControllerModel.AttributeRoutes 2016-03-01 10:28:24 -08:00
Doug Bunting 49ffeb16d2 Test fix: Change `CollectionModelBinderTest` to update `ModelMetadata.IsReadOnly`
- unrelated to #3482 except that I discovered the issue while investigating that issue
- tests previously set `BindingDetails.IsReadOnly` for a `Type` and that was ignored
 - same for `DictionaryModelBinderTest`
2016-02-26 15:58:09 -08:00
Pranav K 80b6996701 * Moving DNX dependencies to test only
* Updating Mvc tests to use dotnet test to run on dnxcore50
2016-02-23 18:58:42 -08:00
Sebastien Ros c259f82615 [Fixes #4112 #4093] Adding support for custom SSL port
New optional MvcOptions.SslPort. If not defined the redirection uses an empty port (default),
otherwise the custom port is used.
2016-02-23 10:21:11 -08:00
Pranav K 5b805bb12d Updating to use cli
Fixes #3908
2016-02-22 17:49:51 -08:00
Kiran Challa 779edb6fe1 React to Routing service collection extension changes 2016-02-22 11:43:08 -08:00
Kiran Challa fd3ee49987 [Fixes #4085] Controller helper inconsistency: HttpNotFound(), Ok() 2016-02-19 09:25:04 -08:00
Ryan Nowak b557ca55d9 Fix behavior of StartsWithPrefix
This undoes a behavior change introduced in
7b18d1d3f1.

The intent was to have ClearValidationState do the right thing for a case
where a collection was bound to the empty prefix, and then used again with
TryUpdateModel.

This change was implemented by saying that a key like "[0].Foo" is a match
for the prefix of "Foo". This isn't really right, and it's only
interesting for the ClearValidationState case.

The problem is that we don't know what the keys look like for a
collection. We can assume that they start with [0] but that's not really a
guarantee, it's a guess.

This change fixes the behavior of StartsWithModel, and move the
responsibility for this case back into ClearValidationState.

This change also removes the call to ClearValidationState from
TryUpdateModel. If you need this behavior, then call ClearValidationState
manually. Trying to bind and then re-bind a model object isn't really what
we intend.
2016-02-17 11:16:16 -08:00
Ajay Bhargav Baaskaran fd6d28d9eb Make AddControllersAsServices not overwrite existing IControllerTypeProvider 2016-02-17 10:14:31 -08:00
jacalvar 910f0139f9 [Fixes #4050] Throw an exception on CanRead/Write and GetSupportedContentTypes when the list of media types is empty 2016-02-16 17:16:16 -08:00
jacalvar 65858b8d8b [Fixes #4051] Split OutputFormatter into OutputFormatter and TextOutputFormatter 2016-02-12 12:04:18 -08:00
Ryan Nowak 698502df8c Rewrite MutableObjectModelBinder
A rewrite focused on simplifying extensibility points and reducing
allocations.
2016-02-10 09:48:05 -08:00
Chris R fa9f13db2d React to MediaTypeHeaderValue.Parse exception message change. 2016-02-08 22:26:55 -08:00