// 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.Collections.Generic;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
///
/// An entry in a .
///
public abstract class ModelStateEntry
{
private ModelErrorCollection _errors;
///
/// Gets the raw value from the request associated with this entry.
///
public object RawValue { get; set; }
///
/// Gets the set of values contained in , joined into a comma-separated string.
///
public string AttemptedValue { get; set; }
///
/// Gets the for this entry.
///
public ModelErrorCollection Errors
{
get
{
if (_errors == null)
{
_errors = new ModelErrorCollection();
}
return _errors;
}
}
///
/// Gets or sets the for this entry.
///
public ModelValidationState ValidationState { get; set; }
///
/// Gets a value that determines if the current instance of is a container node.
/// Container nodes represent prefix nodes that aren't explicitly added to the
/// .
///
public abstract bool IsContainerNode { get; }
///
/// Gets the for a sub-property with the specified .
///
/// The property name to lookup.
/// The if a sub-property was found; otherwise null.
/// This method returns any existing entry, even those with with value true..
public abstract ModelStateEntry GetModelStateForProperty(string propertyName);
///
/// Gets the values for sub-properties.
///
/// This method returns all existing entries, even those with with value true.
public abstract IReadOnlyList Children { get; }
}
}