// 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;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
///
/// Binding info which represents metadata associated to an action parameter.
///
public class BindingInfo
{
///
/// Creates a new .
///
public BindingInfo()
{
}
///
/// Creates a copy of a .
///
/// The to copy.
public BindingInfo(BindingInfo other)
{
if (other == null)
{
throw new ArgumentNullException(nameof(other));
}
BindingSource = other.BindingSource;
BinderModelName = other.BinderModelName;
BinderType = other.BinderType;
PropertyFilterProvider = other.PropertyFilterProvider;
RequestPredicate = other.RequestPredicate;
}
///
/// Gets or sets the .
///
public BindingSource BindingSource { get; set; }
///
/// Gets or sets the binder model name.
///
public string BinderModelName { get; set; }
///
/// Gets or sets the of the model binder used to bind the model.
///
public Type BinderType { get; set; }
///
/// Gets or sets the .
///
public IPropertyFilterProvider PropertyFilterProvider { get; set; }
///
/// Gets or sets a predicate which determines whether or not the model should be bound based on state
/// from the current request.
///
public Func RequestPredicate { get; set; }
///
/// Constructs a new instance of from the given .
///
/// This overload does not account for specified via . Consider using
/// overload, or
/// on the result of this method to to get a more accurate instance.
///
///
/// A collection of attributes which are used to construct
///
/// A new instance of .
public static BindingInfo GetBindingInfo(IEnumerable