Commit Graph

96 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran 47a3aee2c1 [Fixes #3361] Changed the value provider preference to be backwards compatible 2016-01-04 12:55:35 -08:00
Pranav K aab051a20f Rename DictionaryBasedValueProvider to RouteValueProvider
Fixes #3629
2015-12-29 18:51:47 -08:00
Pranav K 2b9dd76535 Make RazorViewEngineOptions.FileProvider a list instead of a single item
Fixes #3806
2015-12-29 14:47:15 -08:00
Hao Kung 0e8113e393 OptionsModel => Options rename 2015-12-21 15:00:31 -08:00
Ryan Nowak 96de1dbe4b Remove IExcludeTypeFilter
- Removes IExcludeTypeFilter
- Replaced with a property 'ValidateChildren' on ModelMetadata
- Teach ValidationVisitor to respect 'ValidateChildren' for enumerable
  types.
2015-12-09 12:30:13 -08:00
David Fowler 99f501152b Remove dependency on ICompilationOptionsProvider
- Removed Configuration from RazorViewEngineOptions
- Added ParseOptions and CompilationOptions to RazorViewEngineOptions
2015-12-07 12:29:52 -08:00
ryanbrandenburg 91e837d465 * Debug log exceptions in JsonInput deserializing 2015-11-30 11:19:22 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -08:00
Pavel Krymets 5ef14e95b7 React to dnx confguration change 2015-11-24 11:54:10 -08:00
Pranav K 292207d17d Reacting to DependencyInjection changes 2015-11-13 10:47:34 -08:00
Pavel Krymets 737a8f3b1d Make Compilation Abstractions naming consistent with Platform Abstractions 2015-11-06 15:53:08 -08:00
Pavel Krymets b4b29e71d6 Rename Microsoft.Dnx.Compilation.Abstractions to Microsoft.Extensions.Compilation.Abstractions 2015-11-03 12:42:28 -08:00
Pavel Krymets 4e8c543489 Rename Microsoft.Runtime.Abstractions to Microsoft.Extensions.PlatformAbstractions 2015-10-22 19:48:55 -07:00
Pranav K f57e180971 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:53 -07:00
Ryan Nowak a318c4599a API Review - Split up .Actions
Abstractions - Core MVC extensibility

Controllers - MVC implementations of .Abstractions and supporting
contracts

Infrastructure - General purpose support APIs. Metadata APIs that don't
fit clearly with a feature or with .Abstraction
2015-09-21 21:54:02 -07:00
Ryan Nowak 538cd9c191 Move less-commonly used types out of .Rendering 2015-09-16 23:52:29 -07:00
N. Taylor Mullen 4fb2053f34 Update project.json to have warningsAsErrors accept a bool. 2015-09-02 15:35:13 -07:00
Hao Kung 3ebdcc5f6f React to options changes 2015-09-02 14:07:06 -07:00
Ryan Nowak 229724c4ea Reorganize MVC namespaces 2015-09-01 22:28:33 -07:00
Pranav K c0d4981452 * Avoid lazyily evaluating IRazorCompilationService in
VirtualPathRazorPageFactory
* Cleanup comments on the lifetime of Razor services.
2015-08-27 17:08:18 -07:00
Ryan Nowak 6d365e9a32 Make ValueProviderResult a string-ish struct 2015-08-21 11:02:40 -07:00
Doug Bunting 48f09d0e8d Do not trounce existing property values that are not bound in `TryUpdateModel` scenarios
- #2836

Part 1: Use existing property values when recursing in `MutableObjectModelBinder`
- remove `ComplexModelDTO` because that indirection made fixing this issue more difficult and doesn't add value
  - started with an old closed PR (#2241) which did some of this work
- correct `MutableObjectModelBinderTest` tests that exercised behaviour that can't occur
  - the old `dto.Results` dictionary was never incomplete; nor could it contain `null` values

Part 2: Change `MutableObjectModelBinder` to pass complex property values into binding system
- model binding no longer trounces nodes in the model tree that aren't bound
- create model instances less often in `TryUpdateModel` scenarios
  - refactor `EnsureModel()` to `GetModel()` and use appropriately
- reorder logic in `SetProperty()` and `AddToProperty()` to avoid copying to / from the same collection
  - also cleans up some code duplication

nits:
- clean up `MutableObjectModelBinderTest`
  - fix odd line wrappings and indentation
  - use `nameof()` more
  - use `string.Empty` more
  - simplify a couple of `Returns()` expressions
- make assertions in `TryUpdateModelIntegrationTest` more readable
  - no need to work through `ModelStateDictionary.Keys`
  - also use `Length` instead of `Count()`; test code but we don't need Linq at all in that test class
2015-08-18 09:57:41 -07:00
Ryan Nowak 9d89a8cac3 Homogenize MVC startup code patterns
Use builder APIS for both AddMvc() and AddMvcCore()
Change various API patterns to all use .AddXyz(...) off of one or both of
these builders.
2015-08-16 18:48:24 -07:00
Ajay Bhargav Baaskaran 4295a57504 [Fixes #2817] Support client side validation for all numeric types 2015-08-13 17:32:13 -07:00
Ryan Nowak f7cea9b6d7 React to namespace change in DI. 2015-08-11 14:10:30 -07:00
Ryan Nowak ff6cbfd7cf Make saving TempData operate via a filter
This change moves the responsibility for saving TempData into a filter,
which is registered with other View features. This moves TempData into the
ViewFeatures package.

ActionResults which require TempData to be kept use a new marker interface
which is handled by the filter.
2015-08-07 16:53:11 -07:00
KevinDockx 94fad918a3 Replace of Add operation (jsonpatch dynamic support) 2015-08-07 16:10:07 -07:00
Doug Bunting bda850187d Add support for jQuery syntax in form data
- #2705
- add `JQueryFormValueProvider` and `JQueryFormValueProviderFactory`
  - carry some code forward from MVC 5; correct to follow current coding guidelines
- refactor `ReadableStringCollectionValueProviderTest` into abstract `EnumerableValueProviderTest`
  - enables reuse in new `JQueryFormValueProviderTest`
  - also run these tests in `CompositeValueProviderTest`

nits:
- do not create a duplicate `CompositeValueProvider` instance in `Filter()`
- correct garbled sentence in `IBindingSourceValueProvider` doc comments
- simplify `FormValueProviderFactoryTest` (no need for Moq) and correct test name
- correct test class / file names
  - `CompositeValueProviderTests` -> `CompositeValueProviderTest`
  - `FormValueProviderFactoryTests` -> `FormValueProviderFactoryTest`
2015-08-05 10:31:24 -07:00
Pranav K 7120b2ff92 Removing MvcViewEngineDescriptor and switching to use OptionsSetup to
setup RazorViewEngine.

Fixes #2269
2015-07-29 14:14:07 -07:00
Victor Hurdugaci e96b4d7b94 React to DNX renames 2015-07-29 04:49:49 -07:00
Ryan Nowak 48bfdceea6 Add basic startup experience for MVC.Core 2015-07-08 17:16:07 -07:00
Ryan Nowak fe52c0c0cb React to removal of Authentication 2015-07-08 15:52:17 -07:00
Ryan Nowak e985fa5d42 Split up MVC.Extensions into smaller packages
Startup.cs API experience to follow in a separate change. This change just
gets the bulk of the code churn out of the way.
2015-07-06 23:41:22 -07:00
Ryan Nowak faaba481e8 Adding an 'AddMinimalMvc()' for Mvc.Core and sample
This adds the ability to configure Mvc.Core for a project; MVC with
minimal services and dependencies.
2015-06-12 11:29:47 -07:00
Ryan Nowak 0861612779 A new pattern for adding multi-registration services
This is some cleanup of how we add multi-registration services to avoid
duplication when calling AddMvcServices multiple times. Also improved
tests to be more clear, and to verify all of our special cases
explicitly.
2015-06-12 11:23:51 -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
Kiran Challa bd035714d0 [Fixes #2648]: Fix registration of MVC services 2015-06-05 09:43:40 -07:00
Kirthi Krishnamraju 337bbad51d React to aspnet/Configuration #195,#198 and fix few minor build break issues 2015-05-20 20:01:23 -07:00
James Newton-King de630754bf SerializerSettings refactor
Add SerializerSettings to MvcOptions and pass those options to the JsonInputFormatter and JsonOutputFormatter.
Remove custom contract resolver.

PR feedback
Pass JsonSerializerSettings to JsonPatchInputFormatter

PR feedback
Make DI JsonOutputFormatter formatter use MvcOptions SerializerSettings

Fix JsonPatchInputFormatter using null ContractResolver

Fix tests
2015-05-11 16:43:17 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Kirthi Krishnamraju e48565dcd8 Adding errors in ModelState 2015-04-22 13:44:09 -07:00
Harsh Gupta c67236141b Fixes 2304:
The fix splits client validation and model validation into two separate hierarchies.
Introduced ClientModelValidatorProvider in MvcOptions, which can be iterated to produce IClientModelValidators.
As a result of this, HtmlGenerator code can be free of ActionBindingContext and directly consumes options.
This also means that we do not modify the client validations during resource filters.
2015-04-15 14:30: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 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
Doug Bunting fc1017fba8 Quick fixes: Clean up test code
- remove useless `configuration` variables and `Configuration` instances
- remove "Review" code comment
 - unintentionally included in commit 4b5dd19
- reduce repeated code in `TestHelper` for functional tests
 - `CreateServer()` methods had duplicate code, an ambiguous match, and an odd order
- rename `GetTestConfiguration()` to `UseCultureReplacer()` in functional tests
2015-03-24 13:42:27 -07:00
Kirthi Krishnamraju a5da5b3acd Removed reflection code; used JsonContract instead and added new JsonPatchInputFormatter 2015-03-23 14:46:54 -07:00
Ryan Nowak f5e7a69693 Updates to the extensibility for validator providers
This change removes reflection from validator providers, and instead
relies on cached metadata in in the modelmetadata.

In general this means that our MVPs don't need to cache anything, they
just look at the metadata and create what they need.

In the case of data-annotations, we update the model details provider to
add validation attributes to the modelmetadata. This would allow someone
to replace the DataAnnotationsValidatorProvider, but still use the
metadata in these attributes.

The change to the IModelValidatorProvider api (to use a context) is
intended to minimize allocations. Currently each validator provider needs
to return a list so you end up with N+1 lists (N validators + a final list
to compine them all). This change will let us just create the final list
(and a small context object). This is a very very high traffic API so it
seemed worth doing.

There's also some general massaging of namespaces and file locations.
2015-03-20 15:19:25 -07:00
N. Taylor Mullen 385fa29407 Update xunit.runner.kre => xunit.runner.aspnet. 2015-03-12 18:01:41 -07:00