Граф коммитов

65 Коммитов

Автор SHA1 Сообщение Дата
Pranav K ecb7edadc8 Remove WebApiCompatShim 2018-11-09 14:32:28 -08:00
Doug Bunting 5cd86977ed
Rename client code generation components
- #8523
- main project / package --> `Microsoft.Extensions.ApiDescription.Design`
- tasks assembly and namespace --> `Microsoft.Extensions.ApiDescription.Tasks`
- tool namespace --> `Microsoft.Extensions.ApiDescription.Tool`
- targets --> verbs e.g. `GenerateTypeScriptNSwag` and `GenerateDocumentDefault`
- `@(ServiceProjectReference)` metadata -> align with common MSBuild project properties
  - exception: `$(MSBuildProjectExtensionsPath)`; it's readonly and `%(ProjectExtensionsPath)` is unambiguous
    - use `%(ProjectExtensionsPath)`
  - also add `%(Targets)` metadata and remove unused `%(ProjectRuntimeIdentifier)`
- `@(<ServiceProjectReferenceMetadata)` metadata -> align with MSBuild project properties
  - exceptions: `$(MSBuildProjectDirectory)`, `$(MSBuildProjectExtensionsPath)` and `$(MSBuildProjectName)`
    - readonly properties and names already unambiguous
2018-10-10 14:52:57 -07:00
Doug Bunting 95b4dc8ca0
Add first cut of Microsoft.Extensions.ApiDescription.Client package / project
- WIP in a number of ways
2018-10-10 14:52:36 -07:00
Pranav K 013697ad89
Remove experimental analyzers 2018-09-07 16:03:06 -07:00
Pranav K 5a20037965
Move API convention analyzers to Microsoft.AspNetCore.Mvc.Api.Analyzers
Fixes #8153
2018-08-02 13:53:33 -07:00
Pranav K e903bda94a
Add test project to Mvc.NoFun.sln 2018-07-20 17:09:20 -07:00
Doug Bunting 4dd4e5ef3e
Shorten names so MVC repo can be cloned on Windows benchmarks server 2018-06-27 14:33:31 -07:00
Pranav K e1eaf6a6e0
Cleanup TestCommon 2018-05-18 10:45:57 -07:00
Pranav K 264f9c871e Add an analyzer to warn against the use of IHtmlHelper.Partial and IHtmlHelper.RenderPartial
Fixes https://github.com/aspnet/Mvc/issues/7417
2018-03-29 21:25:54 -07:00
Pranav K c6c77dd4d3 Introduce Mvc analyzers 2018-01-19 16:02:50 -08:00
Justin Kotalik f7968714a9 Increase minimum required version of visual studio to 15.3.0 (#6856) 2017-09-20 09:42:15 -07:00
Nate McMaster b811e69d00 Use PackageLineup to manage PackageReference versions
- Move the Mvc.Performance project from test/ to benchmarks/.
 - Remove the Version attribute on PackageReference.
 - Add a reference to two PackageLineup's.
 - Add snippet to README explaining the additional requirement to run build.cmd /t:restore.
 - Add a target to check that packages have been pinned.
2017-08-30 12:14:11 -07:00
Nate McMaster b43b244830 Use Directory.Build.props/targets 2017-08-16 12:30:13 -07:00
Ryan Nowak 4214413da0 Remove deleted project from .sln 2017-04-03 19:47:50 -07:00
Ryan Nowak 7d4ccd9c58 Add benchmark project and boilerplate 2017-03-31 11:19:22 -07:00
N. Taylor Mullen acfad83aa6 Migrate to MSBuild
- thanx to @NTaylorMullen for initial conversion
  - e.g. AssemblyInfo.cs files were already minimized or removed :)
- allow `>=` RC3 CLI's to build and run MVC
- work around several dotnet migration issues; see #5482
- disable full .NET Framework runs of functional tests; see #5873
- remove `Microsoft.DotNet.InternalAbstractions` and `System.Xml.XmlDocument` dependencies
- remove project.json (!!), *.xproj, .notest, and web.config files

Redo earlier changes:
- apply test migration to .NET 4.5.2 in *.csproj world
  - see 63507c8 for previous, project.json work
- apply dependency version downgrade from 0097e40 in *.csproj world

Make other test-related changes:
- make Microsoft.AspNetCore.Mvc.TestDiagnosticListener a regular class library
- add support for `/p:GenerateBaselines=true` for functional and Razor.Host tests
- separate `GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameter()` test
  - work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- skip poor test mentioned in #5768
- work around Microsoft/vstest#392
  - rename tests to avoid duplicates
- work around Microsoft/vstest#419
  - set up created `AppDomain`s with current `ApplicationBase`
2017-02-28 21:20:39 -08:00
Pranav K 29cd24f66b Add Microsoft.AspNetCore.Mvc.RazorPages projects 2016-11-17 10:08:38 -08:00
Doug Bunting eea297975d Reduce `HtmlContentBuilder` allocations
- #3918
- lazy-load `TagBuilder.InnerHtml`; add `HasInnerHtml` property for conservative use
 - depends on aspnet/HtmlAbstractions@0781b5a (adds `HtmlContentBuilder.Count`)
- don't use a `HtmlContentBuilder` at all in `DefaultHtmlGenerator.GenerateValidationSummary()`
- avoid instantiating `HtmlContentBuilder` when short-circuits make it unnecessary
- provide correct `HtmlContentBuilder` capacity where known
2016-10-17 14:38:30 -07:00
N. Taylor Mullen fa29396141 Revert "Add Visual Studio specific RC1 binaries."
This reverts commit 687fd72efd, a140440196, 698980943a and 3ebb14ee4b.

#4405
2016-05-16 11:12:24 -07:00
Ryan Nowak 6dbc808fde Clean up .sln files
Remove reference to deleted DNX project
Prevent sources packages from building
2016-05-13 15:03:52 -07:00
Pranav K 92408a5c22 Move samples to Entropy
Partial fix to #4449
2016-05-02 10:06:17 -07:00
N. Taylor Mullen 687fd72efd Add Visual Studio specific RC1 binaries.
- This is needed for Visual Studio RC1 backwards compatibility.
2016-04-04 15:21:19 -07:00
Pranav K 385c21fbe2 Add Microsoft.AspNetCore.Mvc.Dnx to allow using Mvc with DNX 2016-02-26 15:14:32 -08:00
Louis DeJardin c116a38c87 Reducing ModelBindingContext allocations
Closes #4007, Fixes #3622, Fixes #3621

Squashed commit of the following:

commit 4b3095671d945ae79baa4fc4ba22a2ce5ebe488e
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 15:05:58 2016 -0800

    PR Feedback #4007

    ModelBindingContext.ModelType. Need similar changes a couple of
    other places in this class.

commit 7c45847d1d4c3eb02c48710bb4f100d4d1305385
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 15:01:13 2016 -0800

    PR Feedback #4007

    Please clean out the now-extra added usings for System.Diagnostics.

commit 13263fb29a0a12b472eab130eafe6760f6279262
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 14:58:52 2016 -0800

    PR Feedback #4007

    Confusing to read: How can overallResult be non-null here?

commit dfb52e1bd48397580eacf87be3541b159dbe79f1
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 14:47:28 2016 -0800

    PR Feedback #4007

    End these new guys with a period.

commit f4c745a0a805b960234cd4d810378bc40b8e5c8c
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 14:44:10 2016 -0800

    Fixing unit tests

    Also fixes rebase error in CancellationTokenModelBinder

commit f3874cc27388552e863d99d8e6631a2901f8e000
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 13:01:02 2016 -0800

    PR Feedback #4007

    Remove commented-out code.

commit 44ec1a5a3bd4fdeb4d1c4de9f0b402ff0fd34ffe
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 12:22:04 2016 -0800

    PR Feedback #4007

    Why now public?

commit 9aa45eda42ec9b11b7e6b73a14e887f1be8cb130
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Mon Feb 1 12:18:19 2016 -0800

    PR Feedback #4007

    Leave out .Test

commit 58d32d809797d25cc9b5b4c0516ae9e5992fa66e
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 15:41:14 2016 -0800

    PR Feedback #4007

    By making this async, we've undone an optimization here.
    Notice BindModelAync now has a state machine.

commit f7503228b77803b786c19e06e60f618f6f5e15c5
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 15:30:54 2016 -0800

    PR Feedback #4007

    Don't need extra line

commit cf26f3e5125792d6af0ca2afda672e241fe0e164
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 15:28:23 2016 -0800

    PR Feedback #4007

    No longer need most of the using System.Diagnostics additions

commit e90c40c4e4315462efc9ade1585e2e8c085588a4
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 15:12:50 2016 -0800

    PR Feedback #4007

    Suggest Microsoft.AspNetCore.Mvc.Internal.

commit 5360599e9c09ab97b8136977ee0917fd88f51f76
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 14:57:28 2016 -0800

    PR Feedback #4007

    Remove this line.

commit ce63edba51721412684a54886109e6b2225c6c99
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 14:14:02 2016 -0800

    PR Feedback #4007

    incorrect mentions of DefaultModelBindingContext in doc comments

commit bbc738ca2304243839e8d68615ff4bbf14f3279c
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 13:59:50 2016 -0800

    PR Feedback #4007

    Could we convert most of these setups to avoid the
    "async but not await" mess?

commit 0827e6917481e3fafb2905a3fa93cf90afb9be40
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Fri Jan 29 11:02:00 2016 -0800

    PR Feedback #4007

    remove the file

commit 3dd0d10d7f16c94df5f6d34ecb5f2efda62bccd8
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 13:34:31 2016 -0800

    Revert "PR Feedback"

    This reverts commit 589d3e65d406b127a0b833d86c05ad4a8c5172c8.

    It seems the assignment of these properties is not appropriate
    in both cases.

commit c8a97ada63fa16ee7df6c165031bf15b1c23e8a2
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 12:37:18 2016 -0800

    PR Feedback

    DefaultModelBindingContext should not be in Abstractions

commit 5e3b6a1486283f45867830693d4fd23cc967f06f
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 12:35:28 2016 -0800

    PR Feedback

    Is it still needed and, if so, where does the problem lie?

commit 44635a75af05034863f0d4b80b2eb857d43766b2
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 11:06:26 2016 -0800

    PR Feedback

    * this is either supported (shouldn't assert) or not supported (should throw). I don't feel like these asserts add much value
    * this isn't something that should throw

commit 648975cad14ac5e3738ea454c490ca221f650155
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:54:28 2016 -0800

    PR Feedback

    remove the other static constructors for Task<ModelBindingResult>
    they don't have a purpose anymore

commit d0e15211530668ec21406121342715b0d0f606a6
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:51:24 2016 -0800

    PR Feedback

    the reason for the separation was to put the implementation somewhere else

commit 2caf88df7a37664db829d660cbb5266cf6871f2c
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:48:25 2016 -0800

    PR Feedback

    * coding standards...
    * yea
    * private readonly

commit 6c2c640611686a554a8c417a407fe169c45a690e
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:46:12 2016 -0800

    PR Feedback

    * disposable -> <see cref="ModelBindingContextDisposable"/>
    * Fill in the blanks.

commit df07891c798627ac9c8fce6a7598d9386e979615
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:44:07 2016 -0800

    PR Feedback

    Value to assign to the ... for modelName and model as well.

commit 8e9ade7378577eddc0ba8e939deafe8d12781b8a
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 28 10:43:50 2016 -0800

    PR Feedback

    Should this just be an abstract class rather than an interface?

commit a66685e2470a84b0acbf4e797eff5010a1a066ab
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 23:47:44 2016 -0800

    PR Feedback

    Suggest resetting FallbackToEmptyPrefix for current context as part
    of PushContext().

commit d85e66f59d24e0959652f1683cb94c4b513d75c0
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 23:34:42 2016 -0800

    PR Feedback

    Add a using for the Internal namespace.

commit bef09536f881d400f15a83b7788c828903679a38
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 23:27:30 2016 -0800

    PR Feedback

    needs lots of /// doc love and blank lines

commit 4173488112f2889d662d5a7c55f249aefa821c22
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 23:06:49 2016 -0800

    PR Feedback

    Temp file accidentally added. Oops.

commit 6790d6104d5bd72ce7eab270bfe9a360cacf74f2
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 23:04:40 2016 -0800

    PR Feedback

    please remove the else bits after returns

commit 8d077ee27109133d18c5cddfe3b9b6c6e9a40e0e
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 22:57:38 2016 -0800

    PR Feedback

    The code at one point matched the comment -- always returning
    something other than NoResult. Likely the comment needs
    to change.

commit 0ea6c2186212444f46c7a48394b86b14190a9026
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 22:50:02 2016 -0800

    PR Feedback

    Don't recall why this was virtual but why remove that?

commit 0b27f3e62df6836e6e8751967c47c6192c3eec9a
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 22:35:57 2016 -0800

    PR Feedback

    No need for this line; just asserted that Result is already null.

commit c85648bb680bdbdb33381cd1af91133d04d56592
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 22:34:26 2016 -0800

    PR Feedback

    Comment needs some love since NoResult is no more.

commit a606cf32386de9e4566a678b34a195cc0720211a
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 22:18:55 2016 -0800

    PR Feedback

    * Long enough to start wrapping this. Same for a few other properties
      in this class.
    * Why is this check debug-only?
    * /// docs and some blank lines between members

commit 7efce5675a78350a4a7fde4b54fcb7886fe18252
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 20:29:50 2016 -0800

    PR Feedback

    Why not use the Task helper used elsewhere?

commit eb5fe6f95a463eb2f162f51649ffea57db87e286
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 20:28:31 2016 -0800

    PR Feedback

    Sort usings

commit df3bd00c4b59d2434e3a7be28e637d3c8008ae32
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 20:27:38 2016 -0800

    PR Feedback

    Dead code

commit fe7ec17fbb5209f2904f067ec1f91169ab05fb33
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 20:26:04 2016 -0800

    PR Feedback

    Putting internal back in place

commit 496f1f97ac48b2e95572dd6d463ced3366f8d36c
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 20:21:03 2016 -0800

    PR Feedback

    stylecop 13040: Move these to the top of the file.

commit cd003d0bca6516a907a0ae889d2e6130ff473b57
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Wed Jan 27 19:38:15 2016 -0800

    Renames to asp.net core

commit e1cf523119084e35b70f11f67f64f651c39e1c8b
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Jan 21 21:21:44 2016 -0800

    Removing NoResult and fixing tests

commit 5af6223a4d60b6c4139c1fc62ebf297ab0e5454f
Author: Louis DeJardin <lodejard@microsoft.com>
Date:   Thu Dec 17 11:49:08 2015 -0800

    Reducing ModelBindingContext allocations
2016-02-02 12:10:43 -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
Pranav K 32d15186a0 Remove Razor precompilation 2016-01-12 14:51:33 -08:00
ryanbrandenburg cad7d44686 * Add a sample for SubAreas 2016-01-12 11:48:09 -08:00
Ryan Nowak 5ef839c855 Undo accidental adds to .sln 2015-12-29 07:56:20 -08:00
Ryan Nowak 85a4c7edc5 React to changes in routing 2015-12-28 10:15:50 -08:00
ryanbrandenburg 6a16681ed4 * Replace MvcMinimalSample with functional test 2015-12-16 15:18:25 -08:00
Ajay Bhargav Baaskaran 232b27ad5d [Fixes #3430] Removed RouteKeyHandling.CatchAll 2015-12-16 11:57:22 -08:00
Doug Bunting 19e6fb5719 MVC functional test cleanup part 1
- #3612 (subpart 1 of 2)
- delete six sites and associated tests entirely
  - `ActionResultsWebSite`
  - `ActivatorWebSite`
  - `ControllerDiscoveryConventionsWebSite`
  - `LoggingWebSite`
  - `LowercaseUrlsWebSite`
  - `ModelBindingWebSite`, now covered in integration tests
  - remove now-unused `FilteredDefaultAssemblyProviderFixture`, `LoggingAssert` and `LoggingExtensions`
- move six test web sites into `./samples`
  - `CustomRouteWebSite` -> `CustomRouteSample.Web`
  - `FormatFilterWebSite` -> `FormatFilterSample.Web`
  - `InlineConstraintsWebSite` -> `InlineConstraintSample.Web` (now singular)
  - `JsonPatchWebSite` -> `JsonPatchSample.Web`
  - `LocalizationWebSite` -> `LocalizationSample.Web`
  - `RazorEmbeddedViewsWebSite` -> `EmbeddedViewSample.Web` (no longer "Razor" and now singular)
  - do some cleanup: remove test dependencies, shorten sample controller names, use more attribute routing
- correct "license" spelling in `ApplicationModelWebSite`
2015-12-11 13:13:41 -08:00
Kiran Challa 57b88baad0 [Fixes #3624] MVC functional test cleanup (part 2) 2015-12-10 16:26:39 -08:00
Pranav K 79d517483b Removing PageInstrumentation
Fixes #3497
2015-11-25 08:41:21 -08:00
ryanbrandenburg b6f8c523a8 * Remove MvcSample and replace with MvcSandbox 2015-11-23 11:53:48 -08:00
Ryan Nowak 8682fe0cfd Replace ActionBindingContext with ControllerContext
This change introduces ControllerContext for inside of Controllers, and
controller-specific extensibility points. ControllerContext carries with
it the model binding infrastructure needed to do all of the things that
controllers need to do.
2015-11-20 15:32:37 -08:00
Ryan Nowak 173f00fda7 Update to use DiagnosticSource 2015-10-20 11:47:29 -07:00
Ryan Nowak f4c5e31ec1 Remove JsonPatch from MVC
JsonPatch is moving to https://github.com/aspnet/JsonPatch
2015-09-21 11:14:40 -07:00
Ryan Nowak 94388a8804 React to BufferedHtmlContent changes 2015-09-13 13:51:53 -07:00
Ryan Nowak 465b4ce0df Use TelemetrySource 2015-09-06 20:23:05 -07:00
Ryan Nowak e91ce4560f Fix #2338 - Add ViewComponentResult
Makes it easier to render a view component from inside a controller. This
makes it possible to implement behavior where an ajax request refreshes
part of a page.
2015-07-23 17:52:52 -07:00
Kirthi Krishnamraju d8a523a07f Added Mvc localization project 2015-07-16 15:57:24 -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
Ajay Bhargav Baaskaran a3cbb1f378 [Fixes #2684] Removed Mvc.Common
- Removed TaskHelper and refactored with ClosedGenericMatcher
 - Removed TypeHelper
 - Moved custom encodings to InputFormatter
 - Moved ObjectToDictionary to PropertyHelper
 - Removed respective tests and test projects
2015-06-25 16:02:07 -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 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
Kirthi Krishnamraju 30e54609cc Fix #1911 : Create a separate package for ApiExplorer 2015-04-28 13:13:20 -07:00
Ryan Nowak 9fded74b15 Merging ModelBinding into Mvc.Core 2015-04-27 02:10:37 -07:00
Ryan Nowak 572e57e25c Create Mvc.Abstractions
Creates a new package 'Microsoft.AspNet.Mvc.Abstractions' which defines
APIs and contracts for core concepts and extensibility points in MVC.

Includes:
- ModelBinding
- Validation
- Model State
- Model Metadata
- Action Descriptors
- IActionResult
- Filters
- IActionConstraint
2015-04-27 00:49:14 -07:00
Harsh Gupta 53ef8258bb The model state keys for body bound models which are bound at property will use the entire model name with this change for example
Consider

public class Person
{
    [FromBody]
    public Address Address { get; set; }
}

public class Address
{
   [Required]
   public string Street { get; set; }

   public int Zip { get; set; }
}

Request body { "Zip" : 12345 }
In this case the error key would be "prefix.Address.Street" (assuming there is a prefix because of additional metadata/positioning for/of the Person model).

public class Person
{
       [Required]
       public string Name { get; set; }
}

public void Action([FromBody]Person p)
{
}
Request body { }
In this case the prefix gets ignored and the error key is Name.
Please note this is so that we are compatible with MVC 5.0

public class Person
{
       [Required]
       public string Name { get; set; }
}

public void Action([FromBody][ModelBinder(Name = "prefix")] Person p)
{
}

public void Action2([FromBody][Bind(Name = "prefix")] Person p)
{
}
Request body { }
In both these cases (Action and Action2) the prefix gets ignored and the error key is Name.
This is a slight improvement from mvc, as in MVC the action parameter would be null.

The followup for this would be to fix #2416 -
This PR ignores the validation assuming that #2416 will address the issues and update the test.

NOTE: previous versions of mvc did not have property binding and hence there is no precedence in this case. For MVC and Web API it was possible to body bind an action parameter which used an empty prefix instead of a parameter name for adding errors to model state (In case of MVC if a custom prefix was provided, it failed binding from body i.e the parameter was null).
2015-04-22 14:02:08 -07:00