1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Collections.Generic;
\r
16 using System.Diagnostics.CodeAnalysis;
\r
18 public class ModelBindingContext {
\r
20 private static readonly Predicate<string> _defaultPropertyFilter = _ => true;
\r
22 private string _modelName;
\r
23 private ModelStateDictionary _modelState;
\r
24 private Predicate<string> _propertyFilter;
\r
26 public bool FallbackToEmptyPrefix {
\r
31 public object Model {
\r
36 public string ModelName {
\r
38 if (_modelName == null) {
\r
39 _modelName = String.Empty;
\r
48 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",
\r
49 Justification = "The containing type is mutable.")]
\r
50 public ModelStateDictionary ModelState {
\r
52 if (_modelState == null) {
\r
53 _modelState = new ModelStateDictionary();
\r
58 _modelState = value;
\r
62 public Type ModelType {
\r
67 public Predicate<string> PropertyFilter {
\r
69 if (_propertyFilter == null) {
\r
70 _propertyFilter = _defaultPropertyFilter;
\r
72 return _propertyFilter;
\r
75 _propertyFilter = value;
\r
79 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",
\r
80 Justification = "The containing type is mutable.")]
\r
81 public IDictionary<string, ValueProviderResult> ValueProvider {
\r