forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexModelDtoModelBinderProvider.cs
More file actions
27 lines (23 loc) · 1.01 KB
/
ComplexModelDtoModelBinderProvider.cs
File metadata and controls
27 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Web.Http.Controllers;
namespace System.Web.Http.ModelBinding.Binders
{
// Returns a binder that can bind ComplexModelDto objects.
public sealed class ComplexModelDtoModelBinderProvider : ModelBinderProvider
{
// This is really just a simple binder.
private static readonly SimpleModelBinderProvider _underlyingProvider = GetUnderlyingProvider();
public override IModelBinder GetBinder(HttpConfiguration configuration, Type modelType)
{
return _underlyingProvider.GetBinder(configuration, modelType);
}
private static SimpleModelBinderProvider GetUnderlyingProvider()
{
return new SimpleModelBinderProvider(typeof(ComplexModelDto), new ComplexModelDtoModelBinder())
{
SuppressPrefixCheck = true
};
}
}
}