diff --git a/Mvc.NoFun.sln b/Mvc.NoFun.sln index 656cc5be4c..2f77d9633b 100644 --- a/Mvc.NoFun.sln +++ b/Mvc.NoFun.sln @@ -15,12 +15,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Razor" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Core", "src\Microsoft.AspNet.Mvc.Core\Microsoft.AspNet.Mvc.Core.xproj", "{C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ModelBinding", "src\Microsoft.AspNet.Mvc.ModelBinding\Microsoft.AspNet.Mvc.ModelBinding.xproj", "{FA915D3D-22C3-4478-97F2-A81D28B6C503}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Common", "src\Microsoft.AspNet.Mvc.Common\Microsoft.AspNet.Mvc.Common.xproj", "{F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ModelBinding.Test", "test\Microsoft.AspNet.Mvc.ModelBinding.Test\Microsoft.AspNet.Mvc.ModelBinding.Test.xproj", "{3B8DC0C0-6C55-4034-AD96-DE1000928E6B}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Razor.Test", "test\Microsoft.AspNet.Mvc.Razor.Test\Microsoft.AspNet.Mvc.Razor.Test.xproj", "{3F6E355E-4869-41D9-943B-D54771221A7F}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Core.Test", "test\Microsoft.AspNet.Mvc.Core.Test\Microsoft.AspNet.Mvc.Core.Test.xproj", "{A8AA326E-8EE8-4F11-B750-23028E0949D7}" @@ -110,16 +106,6 @@ Global {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|x86.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|x86.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Any CPU.Build.0 = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|x86.ActiveCfg = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -130,16 +116,6 @@ Global {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|x86.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|x86.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Any CPU.Build.0 = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|x86.ActiveCfg = Release|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -395,9 +371,7 @@ Global {079EFA1F-0B0A-4853-B27B-5780D111CD85} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {314E9AD6-2FFC-4A92-A8AD-510658C64F1E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} - {FA915D3D-22C3-4478-97F2-A81D28B6C503} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {3F6E355E-4869-41D9-943B-D54771221A7F} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {A8AA326E-8EE8-4F11-B750-23028E0949D7} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {FBB2B86E-972B-4185-9FF2-62CAB5F8388F} = {DAAE4C74-D06F-4874-A166-33305D2643CE} diff --git a/Mvc.sln b/Mvc.sln index f5f37c357c..9c188d1dec 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -15,12 +15,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Razor" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Core", "src\Microsoft.AspNet.Mvc.Core\Microsoft.AspNet.Mvc.Core.xproj", "{C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ModelBinding", "src\Microsoft.AspNet.Mvc.ModelBinding\Microsoft.AspNet.Mvc.ModelBinding.xproj", "{FA915D3D-22C3-4478-97F2-A81D28B6C503}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Common", "src\Microsoft.AspNet.Mvc.Common\Microsoft.AspNet.Mvc.Common.xproj", "{F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.ModelBinding.Test", "test\Microsoft.AspNet.Mvc.ModelBinding.Test\Microsoft.AspNet.Mvc.ModelBinding.Test.xproj", "{3B8DC0C0-6C55-4034-AD96-DE1000928E6B}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Razor.Test", "test\Microsoft.AspNet.Mvc.Razor.Test\Microsoft.AspNet.Mvc.Razor.Test.xproj", "{3F6E355E-4869-41D9-943B-D54771221A7F}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Mvc.Core.Test", "test\Microsoft.AspNet.Mvc.Core.Test\Microsoft.AspNet.Mvc.Core.Test.xproj", "{A8AA326E-8EE8-4F11-B750-23028E0949D7}" @@ -208,16 +204,6 @@ Global {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|Mixed Platforms.Build.0 = Release|Any CPU {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF}.Release|x86.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Debug|x86.ActiveCfg = Debug|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Any CPU.Build.0 = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {FA915D3D-22C3-4478-97F2-A81D28B6C503}.Release|x86.ActiveCfg = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -228,16 +214,6 @@ Global {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD}.Release|x86.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Debug|x86.ActiveCfg = Debug|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Any CPU.Build.0 = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B}.Release|x86.ActiveCfg = Release|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F6E355E-4869-41D9-943B-D54771221A7F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -1014,9 +990,7 @@ Global {079EFA1F-0B0A-4853-B27B-5780D111CD85} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {314E9AD6-2FFC-4A92-A8AD-510658C64F1E} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {C48DA9D7-ACB5-4408-AA79-27ECB60A67EF} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} - {FA915D3D-22C3-4478-97F2-A81D28B6C503} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} {F3DF6D0B-16FE-4402-B92C-7243A75CF1FD} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} - {3B8DC0C0-6C55-4034-AD96-DE1000928E6B} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {3F6E355E-4869-41D9-943B-D54771221A7F} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {A8AA326E-8EE8-4F11-B750-23028E0949D7} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {FBB2B86E-972B-4185-9FF2-62CAB5F8388F} = {DAAE4C74-D06F-4874-A166-33305D2643CE} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BindAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/BindAttribute.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BindAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/BindAttribute.cs index 482666e400..fe665fa930 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/BindAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.Core/BindAttribute.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.Internal; diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs index f8ba190f5f..808504dc27 100644 --- a/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/DefaultAssemblyProvider.cs @@ -32,7 +32,6 @@ namespace Microsoft.AspNet.Mvc "Microsoft.AspNet.Mvc", "Microsoft.AspNet.Mvc.Abstractions", "Microsoft.AspNet.Mvc.Core", - "Microsoft.AspNet.Mvc.ModelBinding", "Microsoft.AspNet.Mvc.Razor", "Microsoft.AspNet.Mvc.Razor.Host", "Microsoft.AspNet.Mvc.TagHelpers", diff --git a/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs b/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs index 852c2b87f8..ea6590521b 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Description/DefaultApiDescriptionProvider.cs @@ -675,7 +675,7 @@ namespace Microsoft.AspNet.Mvc.Description } else { - return ModelBindingHelper.CreatePropertyModelName(containerName, metadata.PropertyName); + return ModelNames.CreatePropertyModelName(containerName, metadata.PropertyName); } } diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromBodyAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromBodyAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromBodyAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromBodyAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromFormAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromFormAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromFormAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromFormAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromHeaderAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromHeaderAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromHeaderAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromHeaderAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromQueryAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromQueryAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromQueryAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromQueryAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromRouteAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromRouteAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromRouteAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromRouteAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromServicesAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/FromServicesAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/FromServicesAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/FromServicesAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/HiddenInputAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/HiddenInputAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/HiddenInputAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/HiddenInputAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/ModelBinderAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinderAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/BinderMetadata/ModelBinderAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinderAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ArrayModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ArrayModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ArrayModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ArrayModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindNeverAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindNeverAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindNeverAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindNeverAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindRequiredAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindRequiredAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindRequiredAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindRequiredAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BinderTypeBasedModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BinderTypeBasedModelBinder.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BinderTypeBasedModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BinderTypeBasedModelBinder.cs index 23b08ff5c9..1761836a4e 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BinderTypeBasedModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BinderTypeBasedModelBinder.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Threading.Tasks; +using Microsoft.AspNet.Mvc.Core; using Microsoft.Framework.DependencyInjection; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingBehavior.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingBehavior.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingBehavior.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingBehavior.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingBehaviorAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingBehaviorAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingBehaviorAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingBehaviorAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingSourceModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceModelBinder.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingSourceModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceModelBinder.cs index 26d59102d0..e6cb02d16f 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/BindingSourceModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceModelBinder.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; +using Microsoft.AspNet.Mvc.Core; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/BindingSourceValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceValueProvider.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/BindingSourceValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceValueProvider.cs index 9deb124464..937f3e086e 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/BindingSourceValueProvider.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BindingSourceValueProvider.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; +using Microsoft.AspNet.Mvc.Core; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinders/BodyModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/BodyModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.Core/ModelBinders/BodyModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/BodyModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ByteArrayModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ByteArrayModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ByteArrayModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ByteArrayModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CancellationTokenModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CancellationTokenModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CancellationTokenModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/CancellationTokenModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CollectionModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CollectionModelBinder.cs similarity index 91% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CollectionModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/CollectionModelBinder.cs index 7f8e6877c3..52932c574f 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CollectionModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CollectionModelBinder.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Globalization; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding @@ -105,9 +104,9 @@ namespace Microsoft.AspNet.Mvc.ModelBinding // Used when the ValueProvider contains the collection to be bound as multiple elements, e.g. foo[0], foo[1]. private async Task> BindComplexCollection(ModelBindingContext bindingContext) { - var indexPropertyName = ModelBindingHelper.CreatePropertyModelName(bindingContext.ModelName, "index"); + var indexPropertyName = ModelNames.CreatePropertyModelName(bindingContext.ModelName, "index"); var valueProviderResultIndex = await bindingContext.ValueProvider.GetValueAsync(indexPropertyName); - var indexNames = CollectionModelBinderUtil.GetIndexNamesFromValueProviderResult(valueProviderResultIndex); + var indexNames = GetIndexNamesFromValueProviderResult(valueProviderResultIndex); return await BindComplexCollectionFromIndexes(bindingContext, indexNames); } @@ -134,7 +133,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var boundCollection = new List(); foreach (var indexName in indexNames) { - var fullChildName = ModelBindingHelper.CreateIndexModelName(bindingContext.ModelName, indexName); + var fullChildName = ModelNames.CreateIndexModelName(bindingContext.ModelName, indexName); var childBindingContext = ModelBindingContext.GetChildModelBindingContext( bindingContext, fullChildName, @@ -234,5 +233,20 @@ namespace Microsoft.AspNet.Mvc.ModelBinding // fallback return new[] { rawValue }; } + + private static IEnumerable GetIndexNamesFromValueProviderResult(ValueProviderResult valueProviderResult) + { + IEnumerable indexNames = null; + if (valueProviderResult != null) + { + var indexes = (string[])valueProviderResult.ConvertTo(typeof(string[])); + if (indexes != null && indexes.Length > 0) + { + indexNames = indexes; + } + } + + return indexNames; + } } } diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ComplexModelDto.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDto.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ComplexModelDto.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDto.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ComplexModelDtoModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs similarity index 95% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ComplexModelDtoModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs index 65cfdbe381..56da47cb41 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ComplexModelDtoModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ComplexModelDtoModelBinder.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var dto = (ComplexModelDto)bindingContext.Model; foreach (var propertyMetadata in dto.PropertyMetadata) { - var propertyModelName = ModelBindingHelper.CreatePropertyModelName( + var propertyModelName = ModelNames.CreatePropertyModelName( bindingContext.ModelName, propertyMetadata.BinderModelName ?? propertyMetadata.PropertyName); diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CompositeModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeModelBinder.cs similarity index 99% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CompositeModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeModelBinder.cs index 7c1860514b..c055cb028c 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/CompositeModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeModelBinder.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading.Tasks; +using Microsoft.AspNet.Mvc.Core; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/CompositeValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/CompositeValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/DictionaryBasedValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/DictionaryBasedValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryBasedValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/DictionaryModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/DictionaryModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/DictionaryModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ElementalValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ElementalValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ElementalValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/EmptyModelMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/EmptyModelMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/EmptyModelMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/FormCollectionModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/FormCollectionModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormCollectionModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/FormFileModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/FormFileModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormFileModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/FormValueProviderFactory.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormValueProviderFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/FormValueProviderFactory.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/FormValueProviderFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/GenericModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/GenericModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/GenericModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/HeaderModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/HeaderModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/HeaderModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/IBindingSourceValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/IBindingSourceValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/IBindingSourceValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/IBindingSourceValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ICompositeModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ICompositeModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ICompositeModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ICompositeModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ICompositeValueProviderFactory.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ICompositeValueProviderFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ICompositeValueProviderFactory.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ICompositeValueProviderFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/IEnumerableValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/IEnumerableValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/IEnumerableValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/IEnumerableValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/KeyValuePairModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/KeyValuePairModelBinder.cs similarity index 96% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/KeyValuePairModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/KeyValuePairModelBinder.cs index 812cf64a5a..c5ee928c15 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/KeyValuePairModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/KeyValuePairModelBinder.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; +using Microsoft.AspNet.Mvc.Core; namespace Microsoft.AspNet.Mvc.ModelBinding { @@ -61,7 +61,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var propertyModelMetadata = parentBindingContext.OperationBindingContext.MetadataProvider.GetMetadataForType(typeof(TModel)); var propertyModelName = - ModelBindingHelper.CreatePropertyModelName(parentBindingContext.ModelName, propertyName); + ModelNames.CreatePropertyModelName(parentBindingContext.ModelName, propertyName); var propertyBindingContext = ModelBindingContext.GetChildModelBindingContext( parentBindingContext, propertyModelName, diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/BindingMetadata.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/BindingMetadata.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/BindingMetadata.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/BindingMetadata.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/BindingMetadataProviderContext.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/BindingMetadataProviderContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/BindingMetadataProviderContext.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/BindingMetadataProviderContext.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataAnnotationsMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultBindingMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultBindingMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultBindingMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultCompositeMetadataDetailsProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultMetadataDetails.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultMetadataDetails.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultMetadataDetails.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultMetadataDetails.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultModelMetadata.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadata.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultModelMetadata.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadata.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultModelMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultModelMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultModelMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultValidationMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultValidationMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DefaultValidationMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DefaultValidationMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DisplayMetadata.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DisplayMetadata.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DisplayMetadata.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DisplayMetadata.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DisplayMetadataProviderContext.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DisplayMetadataProviderContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/DisplayMetadataProviderContext.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/DisplayMetadataProviderContext.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IBindingMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IBindingMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IBindingMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IBindingMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ICompositeMetadataDetailsProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ICompositeMetadataDetailsProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ICompositeMetadataDetailsProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ICompositeMetadataDetailsProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IDisplayMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IDisplayMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IDisplayMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IDisplayMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IMetadataDetailsProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IMetadataDetailsProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IMetadataDetailsProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IMetadataDetailsProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IValidationMetadataProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IValidationMetadataProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/IValidationMetadataProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/IValidationMetadataProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelAttributes.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ModelAttributes.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ModelAttributes.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ValidationMetadata.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ValidationMetadata.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ValidationMetadata.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ValidationMetadata.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ValidationMetadataProviderContext.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ValidationMetadataProviderContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Metadata/ValidationMetadataProviderContext.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Metadata/ValidationMetadataProviderContext.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ModelExplorerExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelExplorerExtensions.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ModelExplorerExtensions.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelExplorerExtensions.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ModelMetadataProviderExtensions.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelMetadataProviderExtensions.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ModelMetadataProviderExtensions.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelMetadataProviderExtensions.cs index c47e1d6ae0..998348abad 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/ModelMetadataProviderExtensions.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelMetadataProviderExtensions.cs @@ -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.Core; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding diff --git a/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelNames.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelNames.cs new file mode 100644 index 0000000000..3a69d2a7c4 --- /dev/null +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ModelNames.cs @@ -0,0 +1,36 @@ +// 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.Globalization; + +namespace Microsoft.AspNet.Mvc.ModelBinding +{ + public static class ModelNames + { + public static string CreateIndexModelName(string parentName, int index) + { + return CreateIndexModelName(parentName, index.ToString(CultureInfo.InvariantCulture)); + } + + public static string CreateIndexModelName(string parentName, string index) + { + return (parentName.Length == 0) ? "[" + index + "]" : parentName + "[" + index + "]"; + } + + public static string CreatePropertyModelName(string prefix, string propertyName) + { + if (string.IsNullOrEmpty(prefix)) + { + return propertyName ?? string.Empty; + } + else if (string.IsNullOrEmpty(propertyName)) + { + return prefix ?? string.Empty; + } + else + { + return prefix + "." + propertyName; + } + } + } +} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/MutableObjectModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/MutableObjectModelBinder.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/MutableObjectModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/MutableObjectModelBinder.cs index 92dcd1597f..fea1cc44bf 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/MutableObjectModelBinder.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/MutableObjectModelBinder.cs @@ -7,7 +7,7 @@ using System.ComponentModel; using System.Linq; using System.Reflection; using System.Threading.Tasks; -using Microsoft.AspNet.Mvc.ModelBinding.Internal; +using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.ModelBinding.Validation; using Microsoft.Framework.Internal; @@ -150,7 +150,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding { isAnyPropertyEnabledForValueProviderBasedBinding = true; - var propertyModelName = ModelBindingHelper.CreatePropertyModelName( + var propertyModelName = ModelNames.CreatePropertyModelName( context.ModelBindingContext.ModelName, propertyMetadata.BinderModelName ?? propertyMetadata.PropertyName); @@ -395,7 +395,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var propertyExplorer = modelExplorer.GetExplorerForProperty(missingRequiredProperty, model: null); var propertyName = propertyExplorer.Metadata.BinderModelName ?? missingRequiredProperty; - var modelStateKey = ModelBindingHelper.CreatePropertyModelName( + var modelStateKey = ModelNames.CreatePropertyModelName( bindingContext.ModelName, propertyName); @@ -412,7 +412,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding { bindingContext.ModelState.TryAddModelError( modelStateKey, - Resources.FormatMissingRequiredMember(propertyName)); + Resources.FormatModelBinding_MissingRequiredMember(propertyName)); } } @@ -529,7 +529,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding var validationState = bindingContext.ModelState.GetFieldValidationState(modelStateKey); if (validationState == ModelValidationState.Unvalidated) { - var errorMessage = Resources.ModelBinderConfig_ValueRequired; + var errorMessage = Resources.ModelBinding_ValueRequired; bindingContext.ModelState.TryAddModelError(modelStateKey, errorMessage); } } diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/MutableObjectModelBinderContext.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/MutableObjectModelBinderContext.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/MutableObjectModelBinderContext.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/MutableObjectModelBinderContext.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/PrefixContainer.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs similarity index 87% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Internal/PrefixContainer.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs index 6d84b62bae..3cae20a384 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/PrefixContainer.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/PrefixContainer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding.Internal @@ -20,7 +21,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal internal PrefixContainer([NotNull] ICollection values) { _originalValues = values; - _sortedValues = _originalValues.ToArrayWithoutNulls(); + _sortedValues = ToArrayWithoutNulls(_originalValues); Array.Sort(_sortedValues, StringComparer.OrdinalIgnoreCase); } @@ -187,6 +188,36 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal } } + /// + /// Convert an ICollection to an array, removing null values. Fast path for case where + /// there are no null values. + /// + private static T[] ToArrayWithoutNulls(ICollection collection) where T : class + { + Debug.Assert(collection != null); + + var result = new T[collection.Count]; + var count = 0; + foreach (T value in collection) + { + if (value != null) + { + result[count] = value; + count++; + } + } + if (count == collection.Count) + { + return result; + } + else + { + var trimmedResult = new T[count]; + Array.Copy(result, trimmedResult, count); + return trimmedResult; + } + } + private sealed class PrefixComparer : IComparer { private readonly string _prefix; diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/QueryStringValueProviderFactory.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/QueryStringValueProviderFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/QueryStringValueProviderFactory.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/QueryStringValueProviderFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ReadableStringCollectionValueProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/ReadableStringCollectionValueProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ReadableStringCollectionValueProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/RouteValueValueProviderFactory.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/RouteValueValueProviderFactory.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ValueProviders/RouteValueValueProviderFactory.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/RouteValueValueProviderFactory.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ServicesModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/ServicesModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/ServicesModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/ServicesModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/TypeConverterModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/TypeConverterModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeConverterModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Binders/TypeMatchModelBinder.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Binders/TypeMatchModelBinder.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/TypeMatchModelBinder.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompareAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompareAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompareAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompareAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompositeClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompositeClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompositeModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/CompositeModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/CompositeModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorOfTAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsModelValidator.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsModelValidator.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidator.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataAnnotationsModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataTypeAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataTypeAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs index 4bdf7729cb..849da5e2cc 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DataTypeAttributeAdapter.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DataTypeAttributeAdapter.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Microsoft.AspNet.Mvc.Core; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.ModelBinding.Validation diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultClientModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultClientModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultClientModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultModelValidatorProvider.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultModelValidatorProvider.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultModelValidatorProvider.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultObjectValidator.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs similarity index 97% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultObjectValidator.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs index bbe20104eb..51f1fda1ed 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultObjectValidator.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultObjectValidator.cs @@ -156,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation foreach (var childMetadata in metadata.Properties) { - var childKey = ModelBindingHelper.CreatePropertyModelName(currentModelKey, childMetadata.PropertyName); + var childKey = ModelNames.CreatePropertyModelName(currentModelKey, childMetadata.PropertyName); var validationState = modelState.GetFieldValidationState(childKey); if (validationState == ModelValidationState.Unvalidated) @@ -186,7 +186,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation }; var propertyBindingName = propertyMetadata.BinderModelName ?? propertyMetadata.PropertyName; - var childKey = ModelBindingHelper.CreatePropertyModelName(currentModelKey, propertyBindingName); + var childKey = ModelNames.CreatePropertyModelName(currentModelKey, propertyBindingName); if (!ValidateNonVisitedNodeAndChildren( childKey, @@ -224,7 +224,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation if (element != null || anyValidatorsDefined) { var elementExplorer = new ModelExplorer(_modelMetadataProvider, elementMetadata, element); - var elementKey = ModelBindingHelper.CreateIndexModelName(currentKey, index); + var elementKey = ModelNames.CreateIndexModelName(currentKey, index); var elementValidationContext = new ValidationContext() { ModelValidationContext = ModelValidationContext.GetChildValidationContext( @@ -283,7 +283,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation { foreach (var error in validator.Validate(modelValidationContext)) { - var errorKey = ModelBindingHelper.CreatePropertyModelName(modelKey, error.MemberName); + var errorKey = ModelNames.CreatePropertyModelName(modelKey, error.MemberName); if (!modelState.TryAddModelError(errorKey, error.Message) && modelState.GetFieldValidationState(errorKey) == ModelValidationState.Unvalidated) { diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultTypeBasedExcludeFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultTypeBasedExcludeFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultTypeBasedExcludeFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultTypeBasedExcludeFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultTypeNameBasedExcludeFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultTypeNameBasedExcludeFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/DefaultTypeNameBasedExcludeFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/DefaultTypeNameBasedExcludeFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/IExcludeTypeValidationFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/IExcludeTypeValidationFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/IExcludeTypeValidationFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/IExcludeTypeValidationFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/IObjectModelValidator.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/IObjectModelValidator.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/IObjectModelValidator.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/IObjectModelValidator.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/MaxLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MaxLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/MaxLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MaxLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/MinLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MinLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/MinLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/MinLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationEqualToRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationEqualToRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationEqualToRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationEqualToRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMaxLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationMinLengthRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationMinLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationMinLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRangeRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRangeRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRangeRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRangeRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRegexRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRegexRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRegexRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRegexRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRequiredRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRequiredRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationRequiredRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationRequiredRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationStringLengthRule.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ModelClientValidationStringLengthRule.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ModelClientValidationStringLengthRule.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RangeAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RangeAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RangeAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RangeAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ReferenceEqualityComparer.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ReferenceEqualityComparer.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ReferenceEqualityComparer.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ReferenceEqualityComparer.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RegularExpressionAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RegularExpressionAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RegularExpressionAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RequiredAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RequiredAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/RequiredAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/RequiredAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/SimpleTypesExcludeFilter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/SimpleTypesExcludeFilter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/SimpleTypesExcludeFilter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/SimpleTypesExcludeFilter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/StringLengthAttributeAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/StringLengthAttributeAdapter.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/StringLengthAttributeAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/StringLengthAttributeAdapter.cs diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ValidatableObjectAdapter.cs b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs similarity index 98% rename from src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ValidatableObjectAdapter.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs index 9da152887c..5083210986 100644 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Validation/ValidatableObjectAdapter.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ModelBinding/Validation/ValidatableObjectAdapter.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using Microsoft.AspNet.Mvc.Core; namespace Microsoft.AspNet.Mvc.ModelBinding.Validation { diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/ModelMetadataTypeAttribute.cs b/src/Microsoft.AspNet.Mvc.Core/ModelMetadataTypeAttribute.cs similarity index 100% rename from src/Microsoft.AspNet.Mvc.ModelBinding/ModelMetadataTypeAttribute.cs rename to src/Microsoft.AspNet.Mvc.Core/ModelMetadataTypeAttribute.cs diff --git a/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs b/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs index 3b7a09de81..55a97491b8 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ParameterBinding/ModelBindingHelper.cs @@ -5,6 +5,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -365,30 +366,14 @@ namespace Microsoft.AspNet.Mvc (string prefix, Expression> expression) { var propertyName = GetPropertyName(expression.Body); - var property = CreatePropertyModelName(prefix, propertyName); + var property = ModelNames.CreatePropertyModelName(prefix, propertyName); return (context, modelPropertyName) => - property.Equals(CreatePropertyModelName(context.ModelName, modelPropertyName), + property.Equals(ModelNames.CreatePropertyModelName(context.ModelName, modelPropertyName), StringComparison.OrdinalIgnoreCase); } - public static string CreatePropertyModelName(string prefix, string propertyName) - { - if (string.IsNullOrEmpty(prefix)) - { - return propertyName ?? string.Empty; - } - else if (string.IsNullOrEmpty(propertyName)) - { - return prefix ?? string.Empty; - } - else - { - return prefix + "." + propertyName; - } - } - /// /// Clears entries for . /// @@ -445,5 +430,107 @@ namespace Microsoft.AspNet.Mvc return typeof(object); } + + + internal static void ValidateBindingContext([NotNull] ModelBindingContext bindingContext) + { + if (bindingContext.ModelMetadata == null) + { + throw new ArgumentException(Resources.ModelBinderUtil_ModelMetadataCannotBeNull, nameof(bindingContext)); + } + } + + internal static void ValidateBindingContext(ModelBindingContext bindingContext, + Type requiredType, + bool allowNullModel) + { + ValidateBindingContext(bindingContext); + + if (bindingContext.ModelType != requiredType) + { + var message = Resources.FormatModelBinderUtil_ModelTypeIsWrong(bindingContext.ModelType, requiredType); + throw new ArgumentException(message, nameof(bindingContext)); + } + + if (!allowNullModel && bindingContext.Model == null) + { + var message = Resources.FormatModelBinderUtil_ModelCannotBeNull(requiredType); + throw new ArgumentException(message, nameof(bindingContext)); + } + + if (bindingContext.Model != null && + !bindingContext.ModelType.GetTypeInfo().IsAssignableFrom(requiredType.GetTypeInfo())) + { + var message = Resources.FormatModelBinderUtil_ModelInstanceIsWrong( + bindingContext.Model.GetType(), + requiredType); + throw new ArgumentException(message, nameof(bindingContext)); + } + } + + internal static TModel CastOrDefault(object model) + { + return (model is TModel) ? (TModel)model : default(TModel); + } + + internal static Type GetPossibleBinderInstanceType(Type closedModelType, + Type openModelType, + Type openBinderType) + { + var typeArguments = TypeExtensions.GetTypeArgumentsIfMatch(closedModelType, openModelType); + return (typeArguments != null) ? openBinderType.MakeGenericType(typeArguments) : null; + } + + internal static void ReplaceEmptyStringWithNull(ModelMetadata modelMetadata, ref object model) + { + if (model is string && + modelMetadata.ConvertEmptyStringToNull && + string.IsNullOrWhiteSpace(model as string)) + { + model = null; + } + } + + public static object ConvertValuesToCollectionType(Type modelType, IList values) + { + // There's a limited set of collection types we can support here. + // + // For the simple cases - choose a T[] or List if the destination type supports + // it. + // + // For more complex cases, if the destination type is a class and implements ICollection + // then activate it and add the values. + // + // Otherwise just give up. + if (typeof(List).IsAssignableFrom(modelType)) + { + return new List(values); + } + else if (typeof(T[]).IsAssignableFrom(modelType)) + { + return values.ToArray(); + } + else if ( + modelType.GetTypeInfo().IsClass && + !modelType.GetTypeInfo().IsAbstract && + typeof(ICollection).IsAssignableFrom(modelType)) + { + var result = (ICollection)Activator.CreateInstance(modelType); + foreach (var value in values) + { + result.Add(value); + } + + return result; + } + else if (typeof(IEnumerable).IsAssignableFrom(modelType)) + { + return values; + } + else + { + return null; + } + } } } diff --git a/src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs index 7b96a7681b..3313041dfd 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Properties/Resources.Designer.cs @@ -1786,6 +1786,294 @@ namespace Microsoft.AspNet.Mvc.Core return string.Format(CultureInfo.CurrentCulture, GetString("ValueInterfaceAbstractOrOpenGenericTypesCannotBeActivated"), p0, p1); } + /// + /// The type '{0}' must implement '{1}' to be used as a model binder. + /// + internal static string BinderType_MustBeIModelBinder + { + get { return GetString("BinderType_MustBeIModelBinder"); } + } + + /// + /// The type '{0}' must implement '{1}' to be used as a model binder. + /// + internal static string FormatBinderType_MustBeIModelBinder(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BinderType_MustBeIModelBinder"), p0, p1); + } + + /// + /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + /// + internal static string BindingSource_CannotBeComposite + { + get { return GetString("BindingSource_CannotBeComposite"); } + } + + /// + /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + /// + internal static string FormatBindingSource_CannotBeComposite(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeComposite"), p0, p1); + } + + /// + /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + /// + internal static string BindingSource_CannotBeGreedy + { + get { return GetString("BindingSource_CannotBeGreedy"); } + } + + /// + /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + /// + internal static string FormatBindingSource_CannotBeGreedy(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeGreedy"), p0, p1); + } + + /// + /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + /// + internal static string BindingSource_MustBeFromRequest + { + get { return GetString("BindingSource_MustBeFromRequest"); } + } + + /// + /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + /// + internal static string FormatBindingSource_MustBeFromRequest(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeFromRequest"), p0, p1); + } + + /// + /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + /// + internal static string BindingSource_MustBeGreedy + { + get { return GetString("BindingSource_MustBeGreedy"); } + } + + /// + /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + /// + internal static string FormatBindingSource_MustBeGreedy(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeGreedy"), p0, p1); + } + + /// + /// The property {0}.{1} could not be found. + /// + internal static string Common_PropertyNotFound + { + get { return GetString("Common_PropertyNotFound"); } + } + + /// + /// The property {0}.{1} could not be found. + /// + internal static string FormatCommon_PropertyNotFound(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("Common_PropertyNotFound"), p0, p1); + } + + /// + /// A value is required. + /// + internal static string KeyValuePair_BothKeyAndValueMustBePresent + { + get { return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); } + } + + /// + /// A value is required. + /// + internal static string FormatKeyValuePair_BothKeyAndValueMustBePresent() + { + return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); + } + + /// + /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + /// + internal static string ModelBinderUtil_ModelCannotBeNull + { + get { return GetString("ModelBinderUtil_ModelCannotBeNull"); } + } + + /// + /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + /// + internal static string FormatModelBinderUtil_ModelCannotBeNull(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelCannotBeNull"), p0); + } + + /// + /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string ModelBinderUtil_ModelInstanceIsWrong + { + get { return GetString("ModelBinderUtil_ModelInstanceIsWrong"); } + } + + /// + /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string FormatModelBinderUtil_ModelInstanceIsWrong(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelInstanceIsWrong"), p0, p1); + } + + /// + /// The binding context cannot have a null ModelMetadata. + /// + internal static string ModelBinderUtil_ModelMetadataCannotBeNull + { + get { return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); } + } + + /// + /// The binding context cannot have a null ModelMetadata. + /// + internal static string FormatModelBinderUtil_ModelMetadataCannotBeNull() + { + return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); + } + + /// + /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string ModelBinderUtil_ModelTypeIsWrong + { + get { return GetString("ModelBinderUtil_ModelTypeIsWrong"); } + } + + /// + /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + /// + internal static string FormatModelBinderUtil_ModelTypeIsWrong(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelTypeIsWrong"), p0, p1); + } + + /// + /// The value '{0}' is not valid for {1}. + /// + internal static string ModelBinderUtil_ValueInvalid + { + get { return GetString("ModelBinderUtil_ValueInvalid"); } + } + + /// + /// The value '{0}' is not valid for {1}. + /// + internal static string FormatModelBinderUtil_ValueInvalid(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalid"), p0, p1); + } + + /// + /// The supplied value is invalid for {0}. + /// + internal static string ModelBinderUtil_ValueInvalidGeneric + { + get { return GetString("ModelBinderUtil_ValueInvalidGeneric"); } + } + + /// + /// The supplied value is invalid for {0}. + /// + internal static string FormatModelBinderUtil_ValueInvalidGeneric(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalidGeneric"), p0); + } + + /// + /// The '{0}' property is required. + /// + internal static string ModelBinding_MissingRequiredMember + { + get { return GetString("ModelBinding_MissingRequiredMember"); } + } + + /// + /// The '{0}' property is required. + /// + internal static string FormatModelBinding_MissingRequiredMember(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinding_MissingRequiredMember"), p0); + } + + /// + /// A value is required. + /// + internal static string ModelBinding_ValueRequired + { + get { return GetString("ModelBinding_ValueRequired"); } + } + + /// + /// A value is required. + /// + internal static string FormatModelBinding_ValueRequired() + { + return GetString("ModelBinding_ValueRequired"); + } + + /// + /// More than one parameter and/or property is bound to the HTTP request's content. + /// + internal static string MultipleBodyParametersOrPropertiesAreNotAllowed + { + get { return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); } + } + + /// + /// More than one parameter and/or property is bound to the HTTP request's content. + /// + internal static string FormatMultipleBodyParametersOrPropertiesAreNotAllowed() + { + return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); + } + + /// + /// The type '{0}' does not implement the interface '{1}'. + /// + internal static string PropertyBindingPredicateProvider_WrongType + { + get { return GetString("PropertyBindingPredicateProvider_WrongType"); } + } + + /// + /// The type '{0}' does not implement the interface '{1}'. + /// + internal static string FormatPropertyBindingPredicateProvider_WrongType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("PropertyBindingPredicateProvider_WrongType"), p0, p1); + } + + /// + /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + /// + internal static string ValidatableObjectAdapter_IncompatibleType + { + get { return GetString("ValidatableObjectAdapter_IncompatibleType"); } + } + + /// + /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + /// + internal static string FormatValidatableObjectAdapter_IncompatibleType(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("ValidatableObjectAdapter_IncompatibleType"), p0, p1); + } + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name); diff --git a/src/Microsoft.AspNet.Mvc.Core/Resources.resx b/src/Microsoft.AspNet.Mvc.Core/Resources.resx index ccf380dd34..7575c2a6b2 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Resources.resx +++ b/src/Microsoft.AspNet.Mvc.Core/Resources.resx @@ -460,4 +460,58 @@ The type '{0}' cannot be activated by '{1}' because it is either a value type, an interface, an abstract class or an open generic type. + + The type '{0}' must implement '{1}' to be used as a model binder. + + + The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. + + + The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. + + + The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. + + + The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. + + + The property {0}.{1} could not be found. + + + A value is required. + + + The binding context has a null Model, but this binder requires a non-null model of type '{0}'. + + + The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. + + + The binding context cannot have a null ModelMetadata. + + + The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. + + + The value '{0}' is not valid for {1}. + + + The supplied value is invalid for {0}. + + + The '{0}' property is required. + + + A value is required. + + + More than one parameter and/or property is bound to the HTTP request's content. + + + The type '{0}' does not implement the interface '{1}'. + + + The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. + \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.Core/project.json b/src/Microsoft.AspNet.Mvc.Core/project.json index 3d3decd0c3..b92d1066fc 100644 --- a/src/Microsoft.AspNet.Mvc.Core/project.json +++ b/src/Microsoft.AspNet.Mvc.Core/project.json @@ -1,38 +1,44 @@ { - "description": "The core runtime components of ASP.NET MVC.", - "version": "6.0.0-*", - "compilationOptions": { - "warningsAsErrors": true - }, - "dependencies": { - "Microsoft.AspNet.Authentication": "1.0.0-*", - "Microsoft.AspNet.Authorization": "1.0.0-*", - "Microsoft.AspNet.Cors.Core": "1.0.0-*", - "Microsoft.AspNet.DataProtection": "1.0.0-*", - "Microsoft.AspNet.Diagnostics.Interfaces": "1.0.0-*", - "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-*", - "Microsoft.Framework.BufferEntryCollection.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.CopyOnWriteDictionary.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.Logging.Interfaces": "1.0.0-*", - "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.PropertyActivator.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.Runtime.Interfaces": "1.0.0-*", - "Microsoft.Framework.WebEncoders": "1.0.0-*", - "Microsoft.AspNet.JsonPatch": "1.0.0-*" - }, - "frameworks": { - "dnx451": {}, - "dnxcore50": { - "dependencies": { - "Microsoft.CSharp": "4.0.0-beta-*" - } + "description": "The core runtime components of ASP.NET MVC.", + "version": "6.0.0-*", + "compilationOptions": { + "warningsAsErrors": true + }, + "dependencies": { + "Microsoft.AspNet.Authentication": "1.0.0-*", + "Microsoft.AspNet.Authorization": "1.0.0-*", + "Microsoft.AspNet.Cors.Core": "1.0.0-*", + "Microsoft.AspNet.DataProtection": "1.0.0-*", + "Microsoft.AspNet.Diagnostics.Interfaces": "1.0.0-*", + "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.Routing": "1.0.0-*", + "Microsoft.Framework.BufferEntryCollection.Internal": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.CopyOnWriteDictionary.Internal": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.Logging.Interfaces": "1.0.0-*", + "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.PropertyActivator.Internal": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }, + "Microsoft.Framework.Runtime.Interfaces": "1.0.0-*", + "Microsoft.Framework.WebEncoders": "1.0.0-*", + "Microsoft.AspNet.JsonPatch": "1.0.0-*" + }, + "frameworks": { + "dnx451": { + "frameworkAssemblies": { + "System.ComponentModel.DataAnnotations": "", + "System.Runtime.Serialization": "" + } + }, + "dnxcore50": { + "dependencies": { + "System.ComponentModel.Annotations": "4.0.10-beta-*", + "System.Runtime.Serialization.Primitives": "4.0.10-beta-*", + "Microsoft.CSharp": "4.0.0-beta-*" + } + } } - } } diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionExtensions.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionExtensions.cs deleted file mode 100644 index 46362d758d..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionExtensions.cs +++ /dev/null @@ -1,42 +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.Diagnostics; - -namespace Microsoft.AspNet.Mvc.ModelBinding.Internal -{ - public static class CollectionExtensions - { - /// - /// Convert an ICollection to an array, removing null values. Fast path for case where - /// there are no null values. - /// - public static T[] ToArrayWithoutNulls(this ICollection collection) where T : class - { - Debug.Assert(collection != null); - - var result = new T[collection.Count]; - var count = 0; - foreach (T value in collection) - { - if (value != null) - { - result[count] = value; - count++; - } - } - if (count == collection.Count) - { - return result; - } - else - { - var trimmedResult = new T[count]; - Array.Copy(result, trimmedResult, count); - return trimmedResult; - } - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionModelBinderUtil.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionModelBinderUtil.cs deleted file mode 100644 index a95a874c51..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/CollectionModelBinderUtil.cs +++ /dev/null @@ -1,26 +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; - -namespace Microsoft.AspNet.Mvc.ModelBinding.Internal -{ - public static class CollectionModelBinderUtil - { - public static IEnumerable GetIndexNamesFromValueProviderResult(ValueProviderResult valueProviderResult) - { - IEnumerable indexNames = null; - if (valueProviderResult != null) - { - var indexes = (string[])valueProviderResult.ConvertTo(typeof(string[])); - if (indexes != null && indexes.Length > 0) - { - indexNames = indexes; - } - } - - return indexNames; - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/EfficientTypePropertyKey.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/EfficientTypePropertyKey.cs deleted file mode 100644 index e56c49812d..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/EfficientTypePropertyKey.cs +++ /dev/null @@ -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; - -namespace Microsoft.AspNet.Mvc.ModelBinding.Internal -{ - internal class EfficientTypePropertyKey : Tuple - { - private int _hashCode; - - public EfficientTypePropertyKey(T1 item1, T2 item2) - : base(item1, item2) - { - _hashCode = base.GetHashCode(); - } - - public override int GetHashCode() - { - return _hashCode; - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/ModelBindingHelper.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/ModelBindingHelper.cs deleted file mode 100644 index ebbd3ff221..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Internal/ModelBindingHelper.cs +++ /dev/null @@ -1,142 +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.Globalization; -using System.Linq; -using System.Reflection; -using Microsoft.Framework.Internal; - -namespace Microsoft.AspNet.Mvc.ModelBinding.Internal -{ - public static class ModelBindingHelper - { - internal static TModel CastOrDefault(object model) - { - return (model is TModel) ? (TModel)model : default(TModel); - } - - internal static string CreateIndexModelName(string parentName, int index) - { - return CreateIndexModelName(parentName, index.ToString(CultureInfo.InvariantCulture)); - } - - internal static string CreateIndexModelName(string parentName, string index) - { - return (parentName.Length == 0) ? "[" + index + "]" : parentName + "[" + index + "]"; - } - - internal static string CreatePropertyModelName(string prefix, string propertyName) - { - if (string.IsNullOrEmpty(prefix)) - { - return propertyName ?? string.Empty; - } - else if (string.IsNullOrEmpty(propertyName)) - { - return prefix ?? string.Empty; - } - else - { - return prefix + "." + propertyName; - } - } - - internal static Type GetPossibleBinderInstanceType(Type closedModelType, - Type openModelType, - Type openBinderType) - { - var typeArguments = TypeExtensions.GetTypeArgumentsIfMatch(closedModelType, openModelType); - return (typeArguments != null) ? openBinderType.MakeGenericType(typeArguments) : null; - } - - internal static void ReplaceEmptyStringWithNull(ModelMetadata modelMetadata, ref object model) - { - if (model is string && - modelMetadata.ConvertEmptyStringToNull && - string.IsNullOrWhiteSpace(model as string)) - { - model = null; - } - } - - internal static void ValidateBindingContext([NotNull] ModelBindingContext bindingContext) - { - if (bindingContext.ModelMetadata == null) - { - throw new ArgumentException(Resources.ModelBinderUtil_ModelMetadataCannotBeNull, nameof(bindingContext)); - } - } - - internal static void ValidateBindingContext(ModelBindingContext bindingContext, - Type requiredType, - bool allowNullModel) - { - ValidateBindingContext(bindingContext); - - if (bindingContext.ModelType != requiredType) - { - var message = Resources.FormatModelBinderUtil_ModelTypeIsWrong(bindingContext.ModelType, requiredType); - throw new ArgumentException(message, nameof(bindingContext)); - } - - if (!allowNullModel && bindingContext.Model == null) - { - var message = Resources.FormatModelBinderUtil_ModelCannotBeNull(requiredType); - throw new ArgumentException(message, nameof(bindingContext)); - } - - if (bindingContext.Model != null && - !bindingContext.ModelType.GetTypeInfo().IsAssignableFrom(requiredType.GetTypeInfo())) - { - var message = Resources.FormatModelBinderUtil_ModelInstanceIsWrong( - bindingContext.Model.GetType(), - requiredType); - throw new ArgumentException(message, nameof(bindingContext)); - } - } - - public static object ConvertValuesToCollectionType(Type modelType, IList values) - { - // There's a limited set of collection types we can support here. - // - // For the simple cases - choose a T[] or List if the destination type supports - // it. - // - // For more complex cases, if the destination type is a class and implements ICollection - // then activate it and add the values. - // - // Otherwise just give up. - if (typeof(List).IsAssignableFrom(modelType)) - { - return new List(values); - } - else if (typeof(T[]).IsAssignableFrom(modelType)) - { - return values.ToArray(); - } - else if ( - modelType.GetTypeInfo().IsClass && - !modelType.GetTypeInfo().IsAbstract && - typeof(ICollection).IsAssignableFrom(modelType)) - { - var result = (ICollection)Activator.CreateInstance(modelType); - foreach (var value in values) - { - result.Add(value); - } - - return result; - } - else if (typeof(IEnumerable).IsAssignableFrom(modelType)) - { - return values; - } - else - { - return null; - } - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.xproj b/src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.xproj deleted file mode 100644 index 4693d5e347..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Microsoft.AspNet.Mvc.ModelBinding.xproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fa915d3d-22c3-4478-97f2-a81d28b6c503 - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/AssemblyInfo.cs deleted file mode 100644 index 483d113402..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +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.Reflection; -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Microsoft.AspNet.Mvc.ModelBinding.Test")] -[assembly: AssemblyMetadata("Serviceable", "True")] diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/Resources.Designer.cs deleted file mode 100644 index 44ed02e8f1..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Properties/Resources.Designer.cs +++ /dev/null @@ -1,718 +0,0 @@ -// -namespace Microsoft.AspNet.Mvc.ModelBinding -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.AspNet.Mvc.ModelBinding.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// More than one parameter and/or property is bound to the HTTP request's content. - /// - internal static string MultipleBodyParametersOrPropertiesAreNotAllowed - { - get { return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); } - } - - /// - /// More than one parameter and/or property is bound to the HTTP request's content. - /// - internal static string FormatMultipleBodyParametersOrPropertiesAreNotAllowed() - { - return GetString("MultipleBodyParametersOrPropertiesAreNotAllowed"); - } - - /// - /// Value cannot be null or empty. - /// - internal static string ArgumentCannotBeNullOrEmpty - { - get { return GetString("ArgumentCannotBeNullOrEmpty"); } - } - - /// - /// Value cannot be null or empty. - /// - internal static string FormatArgumentCannotBeNullOrEmpty() - { - return GetString("ArgumentCannotBeNullOrEmpty"); - } - - /// - /// A value is required. - /// - internal static string KeyValuePair_BothKeyAndValueMustBePresent - { - get { return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); } - } - - /// - /// A value is required. - /// - internal static string FormatKeyValuePair_BothKeyAndValueMustBePresent() - { - return GetString("KeyValuePair_BothKeyAndValueMustBePresent"); - } - - /// - /// The property {0}.{1} could not be found. - /// - internal static string Common_PropertyNotFound - { - get { return GetString("Common_PropertyNotFound"); } - } - - /// - /// The property {0}.{1} could not be found. - /// - internal static string FormatCommon_PropertyNotFound(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("Common_PropertyNotFound"), p0, p1); - } - - /// - /// The parameter '{0}' could not be found. - /// - internal static string Common_ParameterNotFound - { - get { return GetString("Common_ParameterNotFound"); } - } - - /// - /// The parameter '{0}' could not be found. - /// - internal static string FormatCommon_ParameterNotFound(object p0) - { - return string.Format(CultureInfo.CurrentCulture, GetString("Common_ParameterNotFound"), p0); - } - - /// - /// The type '{0}' must have a public constructor which accepts a single parameter of type '{1}'. - /// - internal static string DataAnnotationsModelValidatorProvider_ConstructorRequirements - { - get { return GetString("DataAnnotationsModelValidatorProvider_ConstructorRequirements"); } - } - - /// - /// The type '{0}' must have a public constructor which accepts a single parameter of type '{1}'. - /// - internal static string FormatDataAnnotationsModelValidatorProvider_ConstructorRequirements(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("DataAnnotationsModelValidatorProvider_ConstructorRequirements"), p0, p1); - } - - /// - /// The key is invalid JQuery syntax because it is missing a closing bracket. - /// - internal static string JQuerySyntaxMissingClosingBracket - { - get { return GetString("JQuerySyntaxMissingClosingBracket"); } - } - - /// - /// The key is invalid JQuery syntax because it is missing a closing bracket. - /// - internal static string FormatJQuerySyntaxMissingClosingBracket() - { - return GetString("JQuerySyntaxMissingClosingBracket"); - } - - /// - /// Property '{0}' on type '{1}' is invalid. Value-typed properties marked as [Required] must also be marked with [DataMember(IsRequired=true)] to be recognized as required. Consider attributing the declaring type with [DataContract] and the property with [DataMember(IsRequired=true)]. - /// - internal static string MissingDataMemberIsRequired - { - get { return GetString("MissingDataMemberIsRequired"); } - } - - /// - /// Property '{0}' on type '{1}' is invalid. Value-typed properties marked as [Required] must also be marked with [DataMember(IsRequired=true)] to be recognized as required. Consider attributing the declaring type with [DataContract] and the property with [DataMember(IsRequired=true)]. - /// - internal static string FormatMissingDataMemberIsRequired(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("MissingDataMemberIsRequired"), p0, p1); - } - - /// - /// The '{0}' property is required. - /// - internal static string MissingRequiredMember - { - get { return GetString("MissingRequiredMember"); } - } - - /// - /// The '{0}' property is required. - /// - internal static string FormatMissingRequiredMember(object p0) - { - return string.Format(CultureInfo.CurrentCulture, GetString("MissingRequiredMember"), p0); - } - - /// - /// The value '{0}' is not valid for {1}. - /// - internal static string ModelBinderConfig_ValueInvalid - { - get { return GetString("ModelBinderConfig_ValueInvalid"); } - } - - /// - /// The value '{0}' is not valid for {1}. - /// - internal static string FormatModelBinderConfig_ValueInvalid(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderConfig_ValueInvalid"), p0, p1); - } - - /// - /// A value is required. - /// - internal static string ModelBinderConfig_ValueRequired - { - get { return GetString("ModelBinderConfig_ValueRequired"); } - } - - /// - /// A value is required. - /// - internal static string FormatModelBinderConfig_ValueRequired() - { - return GetString("ModelBinderConfig_ValueRequired"); - } - - /// - /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. - /// - internal static string ModelBinderUtil_ModelCannotBeNull - { - get { return GetString("ModelBinderUtil_ModelCannotBeNull"); } - } - - /// - /// The binding context has a null Model, but this binder requires a non-null model of type '{0}'. - /// - internal static string FormatModelBinderUtil_ModelCannotBeNull(object p0) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelCannotBeNull"), p0); - } - - /// - /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. - /// - internal static string ModelBinderUtil_ModelInstanceIsWrong - { - get { return GetString("ModelBinderUtil_ModelInstanceIsWrong"); } - } - - /// - /// The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. - /// - internal static string FormatModelBinderUtil_ModelInstanceIsWrong(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelInstanceIsWrong"), p0, p1); - } - - /// - /// The binding context cannot have a null ModelMetadata. - /// - internal static string ModelBinderUtil_ModelMetadataCannotBeNull - { - get { return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); } - } - - /// - /// The binding context cannot have a null ModelMetadata. - /// - internal static string FormatModelBinderUtil_ModelMetadataCannotBeNull() - { - return GetString("ModelBinderUtil_ModelMetadataCannotBeNull"); - } - - /// - /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. - /// - internal static string ModelBinderUtil_ModelTypeIsWrong - { - get { return GetString("ModelBinderUtil_ModelTypeIsWrong"); } - } - - /// - /// The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. - /// - internal static string FormatModelBinderUtil_ModelTypeIsWrong(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ModelTypeIsWrong"), p0, p1); - } - - /// - /// The ModelMetadata property must be set before accessing this property. - /// - internal static string ModelBindingContext_ModelMetadataMustBeSet - { - get { return GetString("ModelBindingContext_ModelMetadataMustBeSet"); } - } - - /// - /// The ModelMetadata property must be set before accessing this property. - /// - internal static string FormatModelBindingContext_ModelMetadataMustBeSet() - { - return GetString("ModelBindingContext_ModelMetadataMustBeSet"); - } - - /// - /// The type '{0}' does not implement the interface '{1}'. - /// - internal static string PropertyBindingPredicateProvider_WrongType - { - get { return GetString("PropertyBindingPredicateProvider_WrongType"); } - } - - /// - /// The type '{0}' does not implement the interface '{1}'. - /// - internal static string FormatPropertyBindingPredicateProvider_WrongType(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("PropertyBindingPredicateProvider_WrongType"), p0, p1); - } - - /// - /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. - /// - internal static string ValidatableObjectAdapter_IncompatibleType - { - get { return GetString("ValidatableObjectAdapter_IncompatibleType"); } - } - - /// - /// The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. - /// - internal static string FormatValidatableObjectAdapter_IncompatibleType(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ValidatableObjectAdapter_IncompatibleType"), p0, p1); - } - - /// - /// Field '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on fields are not supported. Consider using a public property for validation instead. - /// - internal static string ValidationAttributeOnField - { - get { return GetString("ValidationAttributeOnField"); } - } - - /// - /// Field '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on fields are not supported. Consider using a public property for validation instead. - /// - internal static string FormatValidationAttributeOnField(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ValidationAttributeOnField"), p0, p1); - } - - /// - /// Non-public property '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on non-public properties are not supported. Consider using a public property for validation instead. - /// - internal static string ValidationAttributeOnNonPublicProperty - { - get { return GetString("ValidationAttributeOnNonPublicProperty"); } - } - - /// - /// Non-public property '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on non-public properties are not supported. Consider using a public property for validation instead. - /// - internal static string FormatValidationAttributeOnNonPublicProperty(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ValidationAttributeOnNonPublicProperty"), p0, p1); - } - - /// - /// A field previously marked invalid should not be marked valid. - /// - internal static string Validation_InvalidFieldCannotBeReset - { - get { return GetString("Validation_InvalidFieldCannotBeReset"); } - } - - /// - /// A field previously marked invalid should not be marked valid. - /// - internal static string FormatValidation_InvalidFieldCannotBeReset() - { - return GetString("Validation_InvalidFieldCannotBeReset"); - } - - /// - /// A field previously marked invalid should not be marked skipped. - /// - internal static string Validation_InvalidFieldCannotBeReset_ToSkipped - { - get { return GetString("Validation_InvalidFieldCannotBeReset_ToSkipped"); } - } - - /// - /// A field previously marked invalid should not be marked skipped. - /// - internal static string FormatValidation_InvalidFieldCannotBeReset_ToSkipped() - { - return GetString("Validation_InvalidFieldCannotBeReset_ToSkipped"); - } - - /// - /// A value is required but was not present in the request. - /// - internal static string Validation_ValueNotFound - { - get { return GetString("Validation_ValueNotFound"); } - } - - /// - /// A value is required but was not present in the request. - /// - internal static string FormatValidation_ValueNotFound() - { - return GetString("Validation_ValueNotFound"); - } - - /// - /// Cannot convert value '{0}' to enum type '{1}'. - /// - internal static string ValueProviderResult_CannotConvertEnum - { - get { return GetString("ValueProviderResult_CannotConvertEnum"); } - } - - /// - /// Cannot convert value '{0}' to enum type '{1}'. - /// - internal static string FormatValueProviderResult_CannotConvertEnum(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ValueProviderResult_CannotConvertEnum"), p0, p1); - } - - /// - /// The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types. - /// - internal static string ValueProviderResult_NoConverterExists - { - get { return GetString("ValueProviderResult_NoConverterExists"); } - } - - /// - /// The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types. - /// - internal static string FormatValueProviderResult_NoConverterExists(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ValueProviderResult_NoConverterExists"), p0, p1); - } - - /// - /// {0} has a DisplayColumn attribute for {1}, but property {1} does not exist. - /// - internal static string DataAnnotationsModelMetadataProvider_UnknownProperty - { - get { return GetString("DataAnnotationsModelMetadataProvider_UnknownProperty"); } - } - - /// - /// {0} has a DisplayColumn attribute for {1}, but property {1} does not exist. - /// - internal static string FormatDataAnnotationsModelMetadataProvider_UnknownProperty(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("DataAnnotationsModelMetadataProvider_UnknownProperty"), p0, p1); - } - - /// - /// {0} has a DisplayColumn attribute for {1}, but property {1} does not have a public 'get' method. - /// - internal static string DataAnnotationsModelMetadataProvider_UnreadableProperty - { - get { return GetString("DataAnnotationsModelMetadataProvider_UnreadableProperty"); } - } - - /// - /// {0} has a DisplayColumn attribute for {1}, but property {1} does not have a public 'get' method. - /// - internal static string FormatDataAnnotationsModelMetadataProvider_UnreadableProperty(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("DataAnnotationsModelMetadataProvider_UnreadableProperty"), p0, p1); - } - - /// - /// The maximum number of allowed model errors has been reached. - /// - internal static string ModelStateDictionary_MaxModelStateErrors - { - get { return GetString("ModelStateDictionary_MaxModelStateErrors"); } - } - - /// - /// The maximum number of allowed model errors has been reached. - /// - internal static string FormatModelStateDictionary_MaxModelStateErrors() - { - return GetString("ModelStateDictionary_MaxModelStateErrors"); - } - - /// - /// The type '{0}' must implement '{1}' to be used as a model binder. - /// - internal static string BinderType_MustBeIModelBinder - { - get { return GetString("BinderType_MustBeIModelBinder"); } - } - - /// - /// The type '{0}' must implement '{1}' to be used as a model binder. - /// - internal static string FormatBinderType_MustBeIModelBinder(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("BinderType_MustBeIModelBinder"), p0, p1); - } - - /// - /// The value '{0}' is not valid for {1}. - /// - internal static string ModelBinderUtil_ValueInvalid - { - get { return GetString("ModelBinderUtil_ValueInvalid"); } - } - - /// - /// The value '{0}' is not valid for {1}. - /// - internal static string FormatModelBinderUtil_ValueInvalid(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalid"), p0, p1); - } - - /// - /// The supplied value is invalid for {0}. - /// - internal static string ModelBinderUtil_ValueInvalidGeneric - { - get { return GetString("ModelBinderUtil_ValueInvalidGeneric"); } - } - - /// - /// The supplied value is invalid for {0}. - /// - internal static string FormatModelBinderUtil_ValueInvalidGeneric(object p0) - { - return string.Format(CultureInfo.CurrentCulture, GetString("ModelBinderUtil_ValueInvalidGeneric"), p0); - } - - /// - /// Body - /// - internal static string BindingSource_Body - { - get { return GetString("BindingSource_Body"); } - } - - /// - /// Body - /// - internal static string FormatBindingSource_Body() - { - return GetString("BindingSource_Body"); - } - - /// - /// Custom - /// - internal static string BindingSource_Custom - { - get { return GetString("BindingSource_Custom"); } - } - - /// - /// Custom - /// - internal static string FormatBindingSource_Custom() - { - return GetString("BindingSource_Custom"); - } - - /// - /// Form - /// - internal static string BindingSource_Form - { - get { return GetString("BindingSource_Form"); } - } - - /// - /// Form - /// - internal static string FormatBindingSource_Form() - { - return GetString("BindingSource_Form"); - } - - /// - /// Header - /// - internal static string BindingSource_Header - { - get { return GetString("BindingSource_Header"); } - } - - /// - /// Header - /// - internal static string FormatBindingSource_Header() - { - return GetString("BindingSource_Header"); - } - - /// - /// Services - /// - internal static string BindingSource_Services - { - get { return GetString("BindingSource_Services"); } - } - - /// - /// Services - /// - internal static string FormatBindingSource_Services() - { - return GetString("BindingSource_Services"); - } - - /// - /// ModelBinding - /// - internal static string BindingSource_ModelBinding - { - get { return GetString("BindingSource_ModelBinding"); } - } - - /// - /// ModelBinding - /// - internal static string FormatBindingSource_ModelBinding() - { - return GetString("BindingSource_ModelBinding"); - } - - /// - /// Path - /// - internal static string BindingSource_Path - { - get { return GetString("BindingSource_Path"); } - } - - /// - /// Path - /// - internal static string FormatBindingSource_Path() - { - return GetString("BindingSource_Path"); - } - - /// - /// Query - /// - internal static string BindingSource_Query - { - get { return GetString("BindingSource_Query"); } - } - - /// - /// Query - /// - internal static string FormatBindingSource_Query() - { - return GetString("BindingSource_Query"); - } - - /// - /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. - /// - internal static string BindingSource_CannotBeComposite - { - get { return GetString("BindingSource_CannotBeComposite"); } - } - - /// - /// The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. - /// - internal static string FormatBindingSource_CannotBeComposite(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeComposite"), p0, p1); - } - - /// - /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. - /// - internal static string BindingSource_MustBeFromRequest - { - get { return GetString("BindingSource_MustBeFromRequest"); } - } - - /// - /// The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. - /// - internal static string FormatBindingSource_MustBeFromRequest(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeFromRequest"), p0, p1); - } - - /// - /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. - /// - internal static string BindingSource_CannotBeGreedy - { - get { return GetString("BindingSource_CannotBeGreedy"); } - } - - /// - /// The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. - /// - internal static string FormatBindingSource_CannotBeGreedy(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_CannotBeGreedy"), p0, p1); - } - - /// - /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. - /// - internal static string BindingSource_MustBeGreedy - { - get { return GetString("BindingSource_MustBeGreedy"); } - } - - /// - /// The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. - /// - internal static string FormatBindingSource_MustBeGreedy(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("BindingSource_MustBeGreedy"), 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; - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/Resources.resx b/src/Microsoft.AspNet.Mvc.ModelBinding/Resources.resx deleted file mode 100644 index 0654d7794a..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/Resources.resx +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - More than one parameter and/or property is bound to the HTTP request's content. - - - Value cannot be null or empty. - - - A value is required. - - - The property {0}.{1} could not be found. - - - The parameter '{0}' could not be found. - - - The type '{0}' must have a public constructor which accepts a single parameter of type '{1}'. - - - The key is invalid JQuery syntax because it is missing a closing bracket. - - - Property '{0}' on type '{1}' is invalid. Value-typed properties marked as [Required] must also be marked with [DataMember(IsRequired=true)] to be recognized as required. Consider attributing the declaring type with [DataContract] and the property with [DataMember(IsRequired=true)]. - - - The '{0}' property is required. - - - The value '{0}' is not valid for {1}. - - - A value is required. - - - The binding context has a null Model, but this binder requires a non-null model of type '{0}'. - - - The binding context has a Model of type '{0}', but this binder can only operate on models of type '{1}'. - - - The binding context cannot have a null ModelMetadata. - - - The binding context has a ModelType of '{0}', but this binder can only operate on models of type '{1}'. - - - The ModelMetadata property must be set before accessing this property. - - - The type '{0}' does not implement the interface '{1}'. - - - The model object inside the metadata claimed to be compatible with '{0}', but was actually '{1}'. - - - Field '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on fields are not supported. Consider using a public property for validation instead. - - - Non-public property '{0}' on type '{1}' is attributed with one or more validation attributes. Validation attributes on non-public properties are not supported. Consider using a public property for validation instead. - - - A field previously marked invalid should not be marked valid. - - - A field previously marked invalid should not be marked skipped. - - - A value is required but was not present in the request. - - - Cannot convert value '{0}' to enum type '{1}'. - - - The parameter conversion from type '{0}' to type '{1}' failed because no type converter can convert between these types. - - - {0} has a DisplayColumn attribute for {1}, but property {1} does not exist. - - - {0} has a DisplayColumn attribute for {1}, but property {1} does not have a public 'get' method. - - - The maximum number of allowed model errors has been reached. - - - The type '{0}' must implement '{1}' to be used as a model binder. - - - The value '{0}' is not valid for {1}. - - - The supplied value is invalid for {0}. - - - Body - - - Custom - - - Form - - - Header - - - Services - - - ModelBinding - - - Path - - - Query - - - The provided binding source '{0}' is a composite. '{1}' requires that the source must represent a single type of input. - - - The provided binding source '{0}' is not a request-based binding source. '{1}' requires that the source must represent data from an HTTP request. - - - The provided binding source '{0}' is a greedy data source. '{1}' does not support greedy data sources. - - - The provided binding source '{0}' is not a greedy data source. '{1}' only supports greedy data sources. - - \ No newline at end of file diff --git a/src/Microsoft.AspNet.Mvc.ModelBinding/project.json b/src/Microsoft.AspNet.Mvc.ModelBinding/project.json deleted file mode 100644 index 883bd5fda5..0000000000 --- a/src/Microsoft.AspNet.Mvc.ModelBinding/project.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "description": "The ASP.NET MVC model binding components for binding data from a request to an object model.", - "version": "6.0.0-*", - "compilationOptions": { - "warningsAsErrors": true - }, - "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-*", - "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }, - "Microsoft.Net.Http.Headers": "1.0.0-*", - "Newtonsoft.Json": "6.0.6" - }, - "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.ComponentModel.DataAnnotations": "", - "System.Runtime.Serialization": "" - } - }, - "dnxcore50": { - "dependencies": { - "System.Collections.Concurrent": "4.0.10-beta-*", - "System.ComponentModel.Annotations": "4.0.10-beta-*", - "System.ComponentModel.TypeConverter": "4.0.0-beta-*", - "System.ObjectModel": "4.0.10-beta-*", - "System.Reflection.TypeExtensions": "4.0.0-beta-*", - "System.Runtime.Serialization.Primitives": "4.0.10-beta-*" - } - } - } -} diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json index 19857e3de5..e63607438e 100644 --- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json +++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/project.json @@ -7,7 +7,6 @@ "dependencies": { "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Mvc.Core": "6.0.0-*", - "Microsoft.AspNet.Mvc.ModelBinding": "6.0.0-*", "Microsoft.AspNet.WebApi.Client": "5.2.2", "Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" } diff --git a/src/Microsoft.AspNet.Mvc/project.json b/src/Microsoft.AspNet.Mvc/project.json index 5147615251..40eb5de371 100644 --- a/src/Microsoft.AspNet.Mvc/project.json +++ b/src/Microsoft.AspNet.Mvc/project.json @@ -10,6 +10,7 @@ "Microsoft.AspNet.Mvc.Common": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Mvc.Razor": "6.0.0-*", "Microsoft.Framework.Caching.Memory": "1.0.0-*", + "Microsoft.Framework.DependencyInjection": "1.0.0-*", "Microsoft.Framework.PropertyHelper.Internal": { "version": "1.0.0-*", "type": "build" }, "Microsoft.Framework.NotNullAttribute.Internal": { "version": "1.0.0-*", "type": "build" } }, diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/BindAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/BindAttributeTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/BindAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/BindAttributeTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs index db05df9c98..bf7e605303 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultAssemblyProviderTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.Core { CreateLibraryInfo("Microsoft.AspNet.Mvc.Core"), CreateLibraryInfo("Microsoft.AspNet.Mvc"), - CreateLibraryInfo("Microsoft.AspNet.Mvc.ModelBinding"), + CreateLibraryInfo("Microsoft.AspNet.Mvc.Abstractions"), CreateLibraryInfo("SomeRandomAssembly"), }) .Verifiable(); @@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Mvc.Core .Returns(Enumerable.Empty()); manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.Core")) .Returns(new[] { CreateLibraryInfo("Foo") }); - manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.ModelBinding")) + manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc.Abstractions")) .Returns(new[] { CreateLibraryInfo("Bar") }); manager.Setup(f => f.GetReferencingLibraries("Microsoft.AspNet.Mvc")) .Returns(new[] { CreateLibraryInfo("Baz") }); @@ -58,7 +58,7 @@ namespace Microsoft.AspNet.Mvc.Core var candidates = provider.GetCandidateLibraries(); // Assert - Assert.Equal(new[] { "Baz", "Foo", "Bar" }, candidates.Select(a => a.Name)); + Assert.Equal(new[] { "Baz", "Bar", "Foo" }, candidates.Select(a => a.Name)); } [Fact] diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ArrayModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ArrayModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ArrayModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ArrayModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BinderTypeBasedModelBinderModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BinderTypeBasedModelBinderModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BinderTypeBasedModelBinderModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BinderTypeBasedModelBinderModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BindingSourceModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BindingSourceModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BindingSourceModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BindingSourceModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BindingSourceValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BindingSourceValueProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/BindingSourceValueProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/BindingSourceValueProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ByteArrayModelBinderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ByteArrayModelBinderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ByteArrayModelBinderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ByteArrayModelBinderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CancellationTokenModelBinderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CancellationTokenModelBinderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CancellationTokenModelBinderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CancellationTokenModelBinderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CollectionModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CollectionModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CollectionModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CollectionModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ComplexModelDtoTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ComplexModelDtoTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ComplexModelDtoTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ComplexModelDtoTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CompositeModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/CompositeModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/CompositeValueProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/CompositeValueProviderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/CompositeValueProviderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/DictionaryBasedValueProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryBasedValueProviderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/DictionaryBasedValueProviderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryBasedValueProviderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/DictionaryModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/DictionaryModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/DictionaryModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/ElementalValueProviderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ElementalValueProviderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/ElementalValueProviderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ElementalValueProviderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/FormCollectionModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/FormCollectionModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormCollectionModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/FormFileModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormFileModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/FormFileModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormFileModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/FormValueProviderFactoryTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/FormValueProviderFactoryTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/FormValueProviderFactoryTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/HeaderModelBinderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/HeaderModelBinderTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/HeaderModelBinderTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/HeaderModelBinderTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/KeyValuePairModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/KeyValuePairModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/KeyValuePairModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/KeyValuePairModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/BindingSourceTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/BindingSourceTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/BindingSourceTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/BindingSourceTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/CompositeBindingSourceTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/CompositeBindingSourceTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/CompositeBindingSourceTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/CompositeBindingSourceTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs index c6855868dc..0816403a8e 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataAnnotationsMetadataProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataAnnotationsMetadataProviderTest.cs @@ -162,8 +162,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata Name = nameof(Test.Resources.DisplayAttribute_Name), ResourceType = typeof(Test.Resources), #else - Name = nameof(Test.Resources.DisplayAttribute_Name), - ResourceType = typeof(Test.TestResources), + Name = nameof(Core.Test.Resources.DisplayAttribute_Name), + ResourceType = typeof(TestResources), #endif }; @@ -191,8 +191,8 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata Description = nameof(Test.Resources.DisplayAttribute_Description), ResourceType = typeof(Test.Resources), #else - Description = nameof(Test.Resources.DisplayAttribute_Description), - ResourceType = typeof(Test.TestResources), + Description = nameof(Core.Test.Resources.DisplayAttribute_Description), + ResourceType = typeof(TestResources), #endif }; @@ -713,7 +713,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Metadata #if USE_REAL_RESOURCES [Display(Name = nameof(Test.Resources.DisplayAttribute_Name), ResourceType = typeof(Test.Resources))] #else - [Display(Name = nameof(Test.TestResources.DisplayAttribute_Name), ResourceType = typeof(Test.TestResources))] + [Display(Name = nameof(TestResources.DisplayAttribute_Name), ResourceType = typeof(TestResources))] #endif MinusTwo = -2, } diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DataMemberRequiredBindingMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultBindingMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultBindingMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultBindingMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultBindingMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultModelMetadataTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultModelMetadataTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultValidationMetadataTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/DefaultValidationMetadataTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/DefaultValidationMetadataTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/EmptyCompositeMetadataDetailsProvider.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/EmptyCompositeMetadataDetailsProvider.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/EmptyCompositeMetadataDetailsProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelAttributesTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelAttributesTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelAttributesTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelBinderAttributeTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelBinderAttributeTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelBinderAttributeTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelBinderAttributeTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelExplorerExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelExplorerExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelExplorerExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelExplorerExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelMetadataProviderExtensionsTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderExtensionsTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelMetadataProviderExtensionsTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderExtensionsTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelMetadataProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/ModelMetadataProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/ModelMetadataProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/TestModelNameProvider.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/TestModelNameProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Metadata/TestModelNameProvider.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Metadata/TestModelNameProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ModelBindingContextTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ModelBindingContextTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ModelBindingContextTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ModelBindingContextTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ModelBindingResultTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ModelBindingResultTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/ModelBindingResultTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ModelBindingResultTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/MutableObjectModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/MutableObjectModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/MutableObjectModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/MutableObjectModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/QueryStringValueProviderFactoryTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/QueryStringValueProviderFactoryTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/QueryStringValueProviderFactoryTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/QueryStringValueProviderFactoryTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/ReadableStringCollectionValueProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/ValueProviders/ReadableStringCollectionValueProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ReadableStringCollectionValueProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Utils/SimpleHttpValueProvider.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/SimpleHttpValueProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Utils/SimpleHttpValueProvider.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/SimpleHttpValueProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs similarity index 87% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs index 1f5f61e583..61dbff45cd 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestResources.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestResources.cs @@ -1,7 +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. -namespace Microsoft.AspNet.Mvc.ModelBinding.Test +using Microsoft.AspNet.Mvc.Core.Test; + +namespace Microsoft.AspNet.Mvc.ModelBinding { // Wrap resources to make them available as public properties for [Display]. That attribute does not support // internal properties. diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/TestValueProvider.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestValueProvider.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.Core.Test/TestValueProvider.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TestValueProvider.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/TypeConverterModelBinderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TypeConverterModelBinderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Binders/TypeConverterModelBinderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/TypeConverterModelBinderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/CompareAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs similarity index 98% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/CompareAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs index 40b3447211..9415bae95f 100644 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/CompareAttributeAdapterTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompareAttributeAdapterTest.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Validation var attribute = new CompareAttribute("OtherProperty") { ErrorMessageResourceName = "CompareAttributeTestResource", - ErrorMessageResourceType = typeof(Test.Resources), + ErrorMessageResourceType = typeof(Core.Test.Resources), }; var serviceCollection = new ServiceCollection(); var requestServices = serviceCollection.BuildServiceProvider(); diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/CompositeModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompositeModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/CompositeModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/CompositeModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsClientModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsClientModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsClientModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsModelValidatorTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DataAnnotationsModelValidatorTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DataAnnotationsModelValidatorTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultModelClientValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultModelClientValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelClientValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultModelValidatorProviderTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultModelValidatorProviderTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultModelValidatorProviderTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultObjectValidatorTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultObjectValidatorTests.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/DefaultObjectValidatorTests.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/DefaultObjectValidatorTests.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/MaxLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/MaxLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MaxLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/MinLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/MinLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/MinLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/RangeAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/RangeAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RangeAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/ReferenceEqualityComparerTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/ReferenceEqualityComparerTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/ReferenceEqualityComparerTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/ReferenceEqualityComparerTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/RequiredAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/RequiredAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/RequiredAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/StringLengthAttributeAdapterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Validation/StringLengthAttributeAdapterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/Validation/StringLengthAttributeAdapterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Utils/ValidationAttributeUtil.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ValidationAttributeUtil.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/Utils/ValidationAttributeUtil.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/ModelBinding/ValidationAttributeUtil.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs index 300525e63d..96fca5c213 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/Properties/Resources.Designer.cs @@ -10,6 +10,38 @@ namespace Microsoft.AspNet.Mvc.Core.Test private static readonly ResourceManager _resourceManager = new ResourceManager("Microsoft.AspNet.Mvc.Core.Test.Resources", typeof(Resources).GetTypeInfo().Assembly); + /// + /// Comparing {0} to {1}. + /// + internal static string CompareAttributeTestResource + { + get { return GetString("CompareAttributeTestResource"); } + } + + /// + /// Comparing {0} to {1}. + /// + internal static string FormatCompareAttributeTestResource(object p0, object p1) + { + return string.Format(CultureInfo.CurrentCulture, GetString("CompareAttributeTestResource"), p0, p1); + } + + /// + /// description from resources + /// + internal static string DisplayAttribute_Description + { + get { return GetString("DisplayAttribute_Description"); } + } + + /// + /// description from resources + /// + internal static string FormatDisplayAttribute_Description() + { + return GetString("DisplayAttribute_Description"); + } + /// /// name from resources /// diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx b/test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx index 08344b52fb..9ddc5418f7 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx +++ b/test/Microsoft.AspNet.Mvc.Core.Test/Resources.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Comparing {0} to {1}. + + + description from resources + name from resources diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/SimpleTypeExcludeFilterTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/SimpleTypeExcludeFilterTest.cs similarity index 100% rename from test/Microsoft.AspNet.Mvc.ModelBinding.Test/SimpleTypeExcludeFilterTest.cs rename to test/Microsoft.AspNet.Mvc.Core.Test/SimpleTypeExcludeFilterTest.cs diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/project.json b/test/Microsoft.AspNet.Mvc.Core.Test/project.json index 05db42ac65..7eb71173aa 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.Core.Test/project.json @@ -7,6 +7,7 @@ "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Mvc.Xml": "6.0.0-*", "Microsoft.AspNet.Testing": "1.0.0-*", + "Microsoft.Framework.DependencyInjection": "1.0.0-*", "Microsoft.Framework.Logging.Testing": "1.0.0-*", "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*", "Moq": "4.2.1312.1622", diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.xproj b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.xproj deleted file mode 100644 index c2305b3727..0000000000 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Microsoft.AspNet.Mvc.ModelBinding.Test.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 3b8dc0c0-6c55-4034-ad96-de1000928e6b - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Properties/Resources.Designer.cs b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Properties/Resources.Designer.cs deleted file mode 100644 index 97e895f9f0..0000000000 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Properties/Resources.Designer.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -namespace Microsoft.AspNet.Mvc.ModelBinding.Test -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.AspNet.Mvc.ModelBinding.Test.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// Comparing {0} to {1}. - /// - internal static string CompareAttributeTestResource - { - get { return GetString("CompareAttributeTestResource"); } - } - - /// - /// Comparing {0} to {1}. - /// - internal static string FormatCompareAttributeTestResource(object p0, object p1) - { - return string.Format(CultureInfo.CurrentCulture, GetString("CompareAttributeTestResource"), p0, p1); - } - - /// - /// description from resources - /// - internal static string DisplayAttribute_Description - { - get { return GetString("DisplayAttribute_Description"); } - } - - /// - /// description from resources - /// - internal static string FormatDisplayAttribute_Description() - { - return GetString("DisplayAttribute_Description"); - } - - /// - /// name from resources - /// - internal static string DisplayAttribute_Name - { - get { return GetString("DisplayAttribute_Name"); } - } - - /// - /// name from resources - /// - internal static string FormatDisplayAttribute_Name() - { - return GetString("DisplayAttribute_Name"); - } - - 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; - } - } -} diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Resources.resx b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Resources.resx deleted file mode 100644 index 9ddc5418f7..0000000000 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/Resources.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Comparing {0} to {1}. - - - description from resources - - - name from resources - - \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestValueProvider.cs b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestValueProvider.cs deleted file mode 100644 index b63fce6502..0000000000 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/TestValueProvider.cs +++ /dev/null @@ -1,26 +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.Collections.Generic; - -namespace Microsoft.AspNet.Mvc.ModelBinding -{ - public class TestValueProvider : DictionaryBasedValueProvider - { - public static readonly BindingSource TestBindingSource = new BindingSource( - id: "Test", - displayName: "Test", - isGreedy: false, - isFromRequest: true); - - public TestValueProvider(IDictionary values) - : base(TestBindingSource, values) - { - } - - public TestValueProvider(BindingSource bindingSource, IDictionary values) - : base(bindingSource, values) - { - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/project.json b/test/Microsoft.AspNet.Mvc.ModelBinding.Test/project.json deleted file mode 100644 index a3270272d5..0000000000 --- a/test/Microsoft.AspNet.Mvc.ModelBinding.Test/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilationOptions": { - "warningsAsErrors": "true" - }, - "dependencies": { - "Microsoft.AspNet.FileProviders.Interfaces": "1.0.0-*", - "Microsoft.AspNet.Mvc.ModelBinding": "6.0.0-*", - "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, - "Microsoft.AspNet.Testing": "1.0.0-*", - "Moq": "4.2.1312.1622", - "xunit.runner.aspnet": "2.0.0-aspnet-*" - }, - "commands": { - "test": "xunit.runner.aspnet" - }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - } -} diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json index 387a80734b..acce35554a 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/project.json @@ -1,7 +1,7 @@ { "resources": "TestFiles/**", "dependencies": { - "Microsoft.AspNet.Mvc.ModelBinding": "6.0.0-*", + "Microsoft.AspNet.Mvc.Core": "6.0.0-*", "Microsoft.AspNet.Mvc.Razor.Host": "6.0.0-*", "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Testing": "1.0.0-*", diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/project.json b/test/Microsoft.AspNet.Mvc.Razor.Test/project.json index 792791c214..fed25472a8 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Test/project.json +++ b/test/Microsoft.AspNet.Mvc.Razor.Test/project.json @@ -8,6 +8,7 @@ "Microsoft.AspNet.Mvc.Razor": "6.0.0-*", "Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" }, "Microsoft.AspNet.Testing": "1.0.0-*", + "Microsoft.Framework.DependencyInjection": "1.0.0-*", "Microsoft.Framework.WebEncoders.Testing": "1.0.0-*", "Microsoft.Framework.Runtime": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*"