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
This commit is contained in:
Ryan Nowak 2015-04-27 00:11:55 -07:00
parent 088bcac028
commit 572e57e25c
108 changed files with 780 additions and 120 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22808.1
VisualStudioVersion = 14.0.22822.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
EndProject
@ -66,6 +66,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.JsonPatch"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.IntegrationTests", "test\Microsoft.AspNet.Mvc.IntegrationTests\Microsoft.AspNet.Mvc.IntegrationTests.xproj", "{864FA09D-1E48-403A-A6C8-4F079D2A30F0}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions", "src\Microsoft.AspNet.Mvc.Abstractions\Microsoft.AspNet.Mvc.Abstractions.xproj", "{1154203C-7579-4525-906E-BC55268421C1}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions.Test", "test\Microsoft.AspNet.Mvc.Abstractions.Test\Microsoft.AspNet.Mvc.Abstractions.Test.xproj", "{DA000953-7532-4DF5-8DB9-8143DF98D999}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -359,6 +363,30 @@ Global
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|x86.ActiveCfg = Release|Any CPU
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|x86.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|x86.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Any CPU.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|x86.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|x86.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|x86.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|x86.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Any CPU.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -390,5 +418,7 @@ Global
{81C20848-E063-4E12-AC40-0B55A532C16C} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{4D55F4D8-633B-462F-A5B1-FEB84BD2D534} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{864FA09D-1E48-403A-A6C8-4F079D2A30F0} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{1154203C-7579-4525-906E-BC55268421C1} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{DA000953-7532-4DF5-8DB9-8143DF98D999} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
EndGlobalSection
EndGlobal

32
Mvc.sln
View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22808.1
VisualStudioVersion = 14.0.22822.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
EndProject
@ -164,6 +164,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "JsonPatchWebSite", "test\We
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.IntegrationTests", "test\Microsoft.AspNet.Mvc.IntegrationTests\Microsoft.AspNet.Mvc.IntegrationTests.xproj", "{864FA09D-1E48-403A-A6C8-4F079D2A30F0}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions", "src\Microsoft.AspNet.Mvc.Abstractions\Microsoft.AspNet.Mvc.Abstractions.xproj", "{1154203C-7579-4525-906E-BC55268421C1}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Abstractions.Test", "test\Microsoft.AspNet.Mvc.Abstractions.Test\Microsoft.AspNet.Mvc.Abstractions.Test.xproj", "{DA000953-7532-4DF5-8DB9-8143DF98D999}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -978,6 +982,30 @@ Global
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|x86.ActiveCfg = Release|Any CPU
{864FA09D-1E48-403A-A6C8-4F079D2A30F0}.Release|x86.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Debug|x86.Build.0 = Debug|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Any CPU.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|x86.ActiveCfg = Release|Any CPU
{1154203C-7579-4525-906E-BC55268421C1}.Release|x86.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|x86.ActiveCfg = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Debug|x86.Build.0 = Debug|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Any CPU.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.ActiveCfg = Release|Any CPU
{DA000953-7532-4DF5-8DB9-8143DF98D999}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1058,5 +1086,7 @@ Global
{4D55F4D8-633B-462F-A5B1-FEB84BD2D534} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{DAB1252D-577C-4912-98BE-1A812BF83F86} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{864FA09D-1E48-403A-A6C8-4F079D2A30F0} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{1154203C-7579-4525-906E-BC55268421C1} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{DA000953-7532-4DF5-8DB9-8143DF98D999} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
EndGlobalSection
EndGlobal

View File

@ -15,8 +15,8 @@ namespace Microsoft.AspNet.Mvc
/// later in the pipeline.
///
/// When filters have the same Order, the Scope value is used to determine the order of execution. Filters
/// with a higher value of Scope execute later in the pipeline. See <see cref="FilterScope"/> for commonly
/// used scopes.
/// with a higher value of Scope execute later in the pipeline. See <c>Microsoft.AspNet.Mvc.FilterScope</c>
/// for commonly used scopes.
///
/// For <see cref="IExceptionFilter"/> implementions, the filter runs only after an exception has occurred,
/// and so the observed order of execution will be opposite that of other filters.

View File

@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Mvc.ActionConstraints
/// A factory for <see cref="IActionConstraint"/>.
/// </summary>
/// <remarks>
/// <see cref="IActionConstraintFactory"/> will be invoked by <see cref="DefaultActionConstraintProvider"/>
/// <see cref="IActionConstraintFactory"/> will be invoked during action selection
/// to create constraint instances for an action.
///
/// Place an attribute implementing this interface on a controller or action to insert an action

View File

@ -1,8 +1,8 @@
using System;
using Microsoft.Framework.Internal;
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc
{
/// <summary>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="__ToolsVersion__" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>1154203c-7579-4525-906e-bc55268421c1</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -1,8 +1,6 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.AspNet.Mvc.ModelBinding
{
/// <summary>

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNet.Mvc
namespace Microsoft.AspNet.Mvc.ModelBinding
{
/// <summary>
/// Represents an entity which can provide model name as metadata.

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata

View File

@ -2,9 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Mvc.ModelBinding.Metadata;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -222,7 +222,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// If <c>true</c> then the model value is considered required by validators.
/// </para>
/// <para>
/// By default an implicit <see cref="System.ComponentModel.DataAnnotations.RequiredAttribute"/> will be added
/// By default an implicit <c>System.ComponentModel.DataAnnotations.RequiredAttribute</c> will be added
/// if not present when <c>true.</c>.
/// </para>
/// </remarks>

View File

@ -5,7 +5,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding
@ -216,11 +216,11 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
string errorMessage;
if (modelState == null)
{
errorMessage = Resources.FormatModelBinderUtil_ValueInvalidGeneric(key);
errorMessage = Resources.FormatModelError_InvalidValue_GenericMessage(key);
}
else
{
errorMessage = Resources.FormatModelBinderUtil_ValueInvalid(
errorMessage = Resources.FormatModelError_InvalidValue_MessageWithModelValue(
modelState.Value.AttemptedValue,
key);
}
@ -281,7 +281,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
/// state errors; <see cref="ModelValidationState.Valid"/> otherwise.</returns>
public ModelValidationState GetFieldValidationState([NotNull] string key)
{
var entries = DictionaryHelper.FindKeysWithPrefix(this, key);
var entries = FindKeysWithPrefix(this, key);
if (!entries.Any())
{
return ModelValidationState.Unvalidated;
@ -378,7 +378,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
// If key is null or empty, clear all entries in the dictionary
// else just clear the ones that have key as prefix
var entries = (string.IsNullOrEmpty(key)) ?
_innerDictionary : DictionaryHelper.FindKeysWithPrefix(this, key);
_innerDictionary : FindKeysWithPrefix(this, key);
foreach (var entry in entries)
{
@ -501,5 +501,58 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{
return GetEnumerator();
}
private static IEnumerable<KeyValuePair<string, TValue>> FindKeysWithPrefix<TValue>(
[NotNull] IDictionary<string, TValue> dictionary,
[NotNull] string prefix)
{
TValue exactMatchValue;
if (dictionary.TryGetValue(prefix, out exactMatchValue))
{
yield return new KeyValuePair<string, TValue>(prefix, exactMatchValue);
}
foreach (var entry in dictionary)
{
var key = entry.Key;
if (key.Length <= prefix.Length)
{
continue;
}
if (key.StartsWith("[", StringComparison.OrdinalIgnoreCase))
{
key = key.Substring(key.IndexOf('.') + 1);
if (string.Equals(prefix, key, StringComparison.Ordinal))
{
yield return entry;
continue;
}
}
if (!key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{
continue;
}
// Everything is prefixed by the empty string
if (prefix.Length == 0)
{
yield return entry;
}
else
{
var charAfterPrefix = key[prefix.Length];
switch (charAfterPrefix)
{
case '[':
case '.':
yield return entry;
break;
}
}
}
}
}
}

View File

@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.Runtime.ExceptionServices;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -39,22 +39,14 @@ namespace Microsoft.AspNet.Mvc
public MediaTypeHeaderValue SelectedContentType { get; set; }
/// <summary>
/// Gets the status code that was previously set by the <see cref="ObjectResult"/>.
/// Gets the status code that should be used for the response when successfully formatting.
/// </summary>
/// <remarks>
/// Null indicates no value set by the <see cref="ObjectResult"/>.
/// </remarks>
public int? StatusCode { get; set; }
/// <summary>
/// Gets or sets a flag to indicate that content-negotiation could not find a formatter based on the
/// information on the <see cref="Http.HttpRequest"/>.
/// </summary>
/// <remarks>
/// A <see cref="IOutputFormatter"/> can use this information to decide how to write a response.
/// For example, the <see cref="HttpNotAcceptableOutputFormatter"/> sets a 406 Not Acceptable response
/// when content negotiation has failed.
/// </remarks>
public bool? FailedContentNegotiation { get; set; }
}
}

View File

@ -0,0 +1,9 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.Abstractions.Test")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: AssemblyMetadata("Serviceable", "True")]

View File

@ -0,0 +1,366 @@
// <auto-generated />
namespace Microsoft.AspNet.Mvc.Abstractions
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class Resources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.AspNet.Mvc.Abstractions.Resources", typeof(Resources).GetTypeInfo().Assembly);
/// <summary>
/// Value cannot be null or empty.
/// </summary>
internal static string ArgumentCannotBeNullOrEmpty
{
get { return GetString("ArgumentCannotBeNullOrEmpty"); }
}
/// <summary>
/// Value cannot be null or empty.
/// </summary>
internal static string FormatArgumentCannotBeNullOrEmpty()
{
return GetString("ArgumentCannotBeNullOrEmpty");
}
/// <summary>
/// The ModelMetadata property must be set before accessing this property.
/// </summary>
internal static string ModelBindingContext_ModelMetadataMustBeSet
{
get { return GetString("ModelBindingContext_ModelMetadataMustBeSet"); }
}
/// <summary>
/// The ModelMetadata property must be set before accessing this property.
/// </summary>
internal static string FormatModelBindingContext_ModelMetadataMustBeSet()
{
return GetString("ModelBindingContext_ModelMetadataMustBeSet");
}
/// <summary>
/// A field previously marked invalid should not be marked valid.
/// </summary>
internal static string Validation_InvalidFieldCannotBeReset
{
get { return GetString("Validation_InvalidFieldCannotBeReset"); }
}
/// <summary>
/// A field previously marked invalid should not be marked valid.
/// </summary>
internal static string FormatValidation_InvalidFieldCannotBeReset()
{
return GetString("Validation_InvalidFieldCannotBeReset");
}
/// <summary>
/// A field previously marked invalid should not be marked skipped.
/// </summary>
internal static string Validation_InvalidFieldCannotBeReset_ToSkipped
{
get { return GetString("Validation_InvalidFieldCannotBeReset_ToSkipped"); }
}
/// <summary>
/// A field previously marked invalid should not be marked skipped.
/// </summary>
internal static string FormatValidation_InvalidFieldCannotBeReset_ToSkipped()
{
return GetString("Validation_InvalidFieldCannotBeReset_ToSkipped");
}
/// <summary>
/// Cannot convert value '{0}' to enum type '{1}'.
/// </summary>
internal static string ValueProviderResult_CannotConvertEnum
{
get { return GetString("ValueProviderResult_CannotConvertEnum"); }
}
/// <summary>
/// Cannot convert value '{0}' to enum type '{1}'.
/// </summary>
internal static string FormatValueProviderResult_CannotConvertEnum(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ValueProviderResult_CannotConvertEnum"), p0, p1);
}
/// <summary>
/// The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types.
/// </summary>
internal static string ValueProviderResult_NoConverterExists
{
get { return GetString("ValueProviderResult_NoConverterExists"); }
}
/// <summary>
/// The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types.
/// </summary>
internal static string FormatValueProviderResult_NoConverterExists(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ValueProviderResult_NoConverterExists"), p0, p1);
}
/// <summary>
/// The maximum number of allowed model errors has been reached.
/// </summary>
internal static string ModelStateDictionary_MaxModelStateErrors
{
get { return GetString("ModelStateDictionary_MaxModelStateErrors"); }
}
/// <summary>
/// The maximum number of allowed model errors has been reached.
/// </summary>
internal static string FormatModelStateDictionary_MaxModelStateErrors()
{
return GetString("ModelStateDictionary_MaxModelStateErrors");
}
/// <summary>
/// Body
/// </summary>
internal static string BindingSource_Body
{
get { return GetString("BindingSource_Body"); }
}
/// <summary>
/// Body
/// </summary>
internal static string FormatBindingSource_Body()
{
return GetString("BindingSource_Body");
}
/// <summary>
/// Custom
/// </summary>
internal static string BindingSource_Custom
{
get { return GetString("BindingSource_Custom"); }
}
/// <summary>
/// Custom
/// </summary>
internal static string FormatBindingSource_Custom()
{
return GetString("BindingSource_Custom");
}
/// <summary>
/// Form
/// </summary>
internal static string BindingSource_Form
{
get { return GetString("BindingSource_Form"); }
}
/// <summary>
/// Form
/// </summary>
internal static string FormatBindingSource_Form()
{
return GetString("BindingSource_Form");
}
/// <summary>
/// Header
/// </summary>
internal static string BindingSource_Header
{
get { return GetString("BindingSource_Header"); }
}
/// <summary>
/// Header
/// </summary>
internal static string FormatBindingSource_Header()
{
return GetString("BindingSource_Header");
}
/// <summary>
/// Services
/// </summary>
internal static string BindingSource_Services
{
get { return GetString("BindingSource_Services"); }
}
/// <summary>
/// Services
/// </summary>
internal static string FormatBindingSource_Services()
{
return GetString("BindingSource_Services");
}
/// <summary>
/// ModelBinding
/// </summary>
internal static string BindingSource_ModelBinding
{
get { return GetString("BindingSource_ModelBinding"); }
}
/// <summary>
/// ModelBinding
/// </summary>
internal static string FormatBindingSource_ModelBinding()
{
return GetString("BindingSource_ModelBinding");
}
/// <summary>
/// Path
/// </summary>
internal static string BindingSource_Path
{
get { return GetString("BindingSource_Path"); }
}
/// <summary>
/// Path
/// </summary>
internal static string FormatBindingSource_Path()
{
return GetString("BindingSource_Path");
}
/// <summary>
/// Query
/// </summary>
internal static string BindingSource_Query
{
get { return GetString("BindingSource_Query"); }
}
/// <summary>
/// Query
/// </summary>
internal static string FormatBindingSource_Query()
{
return GetString("BindingSource_Query");
}
/// <summary>
/// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input.
/// </summary>
internal static string BindingSource_CannotBeComposite
{
get { return GetString("BindingSource_CannotBeComposite"); }
}
/// <summary>
/// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input.
/// </summary>
internal static string FormatBindingSource_CannotBeComposite(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeComposite"), p0, p1);
}
/// <summary>
/// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request.
/// </summary>
internal static string BindingSource_MustBeFromRequest
{
get { return GetString("BindingSource_MustBeFromRequest"); }
}
/// <summary>
/// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request.
/// </summary>
internal static string FormatBindingSource_MustBeFromRequest(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeFromRequest"), p0, p1);
}
/// <summary>
/// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources.
/// </summary>
internal static string BindingSource_CannotBeGreedy
{
get { return GetString("BindingSource_CannotBeGreedy"); }
}
/// <summary>
/// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources.
/// </summary>
internal static string FormatBindingSource_CannotBeGreedy(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeGreedy"), p0, p1);
}
/// <summary>
/// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources.
/// </summary>
internal static string BindingSource_MustBeGreedy
{
get { return GetString("BindingSource_MustBeGreedy"); }
}
/// <summary>
/// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources.
/// </summary>
internal static string FormatBindingSource_MustBeGreedy(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeGreedy"), p0, p1);
}
/// <summary>
/// The supplied value is invalid for {0}.
/// </summary>
internal static string ModelError_InvalidValue_GenericMessage
{
get { return GetString("ModelError_InvalidValue_GenericMessage"); }
}
/// <summary>
/// The supplied value is invalid for {0}.
/// </summary>
internal static string FormatModelError_InvalidValue_GenericMessage(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ModelError_InvalidValue_GenericMessage"), p0);
}
/// <summary>
/// The value '{0}' is not valid for {1}.
/// </summary>
internal static string ModelError_InvalidValue_MessageWithModelValue
{
get { return GetString("ModelError_InvalidValue_MessageWithModelValue"); }
}
/// <summary>
/// The value '{0}' is not valid for {1}.
/// </summary>
internal static string FormatModelError_InvalidValue_MessageWithModelValue(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ModelError_InvalidValue_MessageWithModelValue"), p0, p1);
}
private static string GetString(string name, params string[] formatterNames)
{
var value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
if (formatterNames != null)
{
for (var i = 0; i < formatterNames.Length; i++)
{
value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
}
return value;
}
}
}

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ArgumentCannotBeNullOrEmpty" xml:space="preserve">
<value>Value cannot be null or empty.</value>
</data>
<data name="ModelBindingContext_ModelMetadataMustBeSet" xml:space="preserve">
<value>The ModelMetadata property must be set before accessing this property.</value>
</data>
<data name="Validation_InvalidFieldCannotBeReset" xml:space="preserve">
<value>A field previously marked invalid should not be marked valid.</value>
</data>
<data name="Validation_InvalidFieldCannotBeReset_ToSkipped" xml:space="preserve">
<value>A field previously marked invalid should not be marked skipped.</value>
</data>
<data name="ValueProviderResult_CannotConvertEnum" xml:space="preserve">
<value>Cannot convert value '{0}' to enum type '{1}'.</value>
</data>
<data name="ValueProviderResult_NoConverterExists" xml:space="preserve">
<value>The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types.</value>
</data>
<data name="ModelStateDictionary_MaxModelStateErrors" xml:space="preserve">
<value>The maximum number of allowed model errors has been reached.</value>
</data>
<data name="BindingSource_Body" xml:space="preserve">
<value>Body</value>
</data>
<data name="BindingSource_Custom" xml:space="preserve">
<value>Custom</value>
</data>
<data name="BindingSource_Form" xml:space="preserve">
<value>Form</value>
</data>
<data name="BindingSource_Header" xml:space="preserve">
<value>Header</value>
</data>
<data name="BindingSource_Services" xml:space="preserve">
<value>Services</value>
</data>
<data name="BindingSource_ModelBinding" xml:space="preserve">
<value>ModelBinding</value>
</data>
<data name="BindingSource_Path" xml:space="preserve">
<value>Path</value>
</data>
<data name="BindingSource_Query" xml:space="preserve">
<value>Query</value>
</data>
<data name="BindingSource_CannotBeComposite" xml:space="preserve">
<value>The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input.</value>
</data>
<data name="BindingSource_MustBeFromRequest" xml:space="preserve">
<value>The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request.</value>
</data>
<data name="BindingSource_CannotBeGreedy" xml:space="preserve">
<value>The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources.</value>
</data>
<data name="BindingSource_MustBeGreedy" xml:space="preserve">
<value>The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources.</value>
</data>
<data name="ModelError_InvalidValue_GenericMessage" xml:space="preserve">
<value>The supplied value is invalid for {0}.</value>
</data>
<data name="ModelError_InvalidValue_MessageWithModelValue" xml:space="preserve">
<value>The value '{0}' is not valid for {1}.</value>
</data>
</root>

View File

@ -0,0 +1,23 @@
{
"description": "The core abstractions of ASP.NET MVC.",
"version": "6.0.0-*",
"compilationOptions": {
"warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNet.Http.Interfaces": "1.0.0-*",
"Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" },
"Microsoft.AspNet.Routing": "1.0.0-*",
"Microsoft.Framework.CopyOnWriteDictionary.Internal": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }
},
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.0-beta-*"
}
}
}
}

View File

@ -30,6 +30,7 @@ namespace Microsoft.AspNet.Mvc
protected virtual HashSet<string> ReferenceAssemblies { get; } = new HashSet<string>(StringComparer.Ordinal)
{
"Microsoft.AspNet.Mvc",
"Microsoft.AspNet.Mvc.Abstractions",
"Microsoft.AspNet.Mvc.Core",
"Microsoft.AspNet.Mvc.ModelBinding",
"Microsoft.AspNet.Mvc.Razor",

View File

@ -1,23 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
using System.Linq;
namespace System.Collections.Generic
{
internal static class IEnumerableExtensions
{
public static T[] AsArray<T>(this IEnumerable<T> values)
{
Debug.Assert(values != null);
var array = values as T[];
if (array == null)
{
array = values.ToArray();
}
return array;
}
}
}

View File

@ -13,6 +13,7 @@
"Microsoft.AspNet.FileProviders.Interfaces": "1.0.0-*",
"Microsoft.AspNet.Hosting.Interfaces": "1.0.0-*",
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-*",
"Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" },
"Microsoft.AspNet.Mvc.ModelBinding": "6.0.0-*",
"Microsoft.AspNet.Routing": "1.0.0-*",

View File

@ -1,66 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
{
public static class DictionaryHelper
{
public static IEnumerable<KeyValuePair<string, TValue>> FindKeysWithPrefix<TValue>(
[NotNull] IDictionary<string, TValue> dictionary,
[NotNull] string prefix)
{
TValue exactMatchValue;
if (dictionary.TryGetValue(prefix, out exactMatchValue))
{
yield return new KeyValuePair<string, TValue>(prefix, exactMatchValue);
}
foreach (var entry in dictionary)
{
var key = entry.Key;
if (key.Length <= prefix.Length)
{
continue;
}
if (key.StartsWith("[", StringComparison.OrdinalIgnoreCase))
{
key = key.Substring(key.IndexOf('.') + 1);
if (string.Equals(prefix, key, StringComparison.Ordinal))
{
yield return entry;
continue;
}
}
if (!key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{
continue;
}
// Everything is prefixed by the empty string
if (prefix.Length == 0)
{
yield return entry;
}
else
{
var charAfterPrefix = key[prefix.Length];
switch (charAfterPrefix)
{
case '[':
case '.':
yield return entry;
break;
}
}
}
}
}
}

View File

@ -7,6 +7,7 @@
"dependencies": {
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-*",
"Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" },
"Microsoft.Framework.CopyOnWriteDictionary.Internal": { "version": "1.0.0-*", "type": "build" },
"Microsoft.Framework.DependencyInjection": "1.0.0-*",

Some files were not shown because too many files have changed in this diff Show More