BindingSource Class

A metadata object representing a source of data for model binding.

Namespace
Microsoft.AspNetCore.Mvc.ModelBinding
Assemblies
  • Microsoft.AspNetCore.Mvc.Abstractions

Syntax

[DebuggerDisplay("Source: {DisplayName}")]
public class BindingSource : IEquatable<BindingSource>
class Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource

Constructors

BindingSource(System.String, System.String, System.Boolean, System.Boolean)

Creates a new Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource.

Arguments:
  • id (System.String) – The id, a unique identifier.
  • displayName (System.String) – The display name.
  • isGreedy (System.Boolean) – A value indicating whether or not the source is greedy.
  • isFromRequest (System.Boolean) – A value indicating whether or not the data comes from the HTTP request.
public BindingSource(string id, string displayName, bool isGreedy, bool isFromRequest)

Methods

CanAcceptDataFrom(Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource)

Gets a value indicating whether or not the Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource can accept data from <em>bindingSource</em>.

Arguments:bindingSource (Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource) – The Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource to consider as input.
Return type:System.Boolean
Returns:<code>True</code> if the source is compatible, otherwise <code>false</code>.
public virtual bool CanAcceptDataFrom(BindingSource bindingSource)
Equals(Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource)
Return type:System.Boolean
public bool Equals(BindingSource other)
Equals(System.Object)
Return type:System.Boolean
public override bool Equals(object obj)
GetHashCode()
Return type:System.Int32
public override int GetHashCode()

Operators

Equality(Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource, Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource)
Return type:System.Boolean
public static bool operator ==(BindingSource s1, BindingSource s2)
Inequality(Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource, Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource)
Return type:System.Boolean
public static bool operator !=(BindingSource s1, BindingSource s2)

Fields

Body()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for the request body.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Body
Custom()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for a custom model binder (unknown data source).

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Custom
Form()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for the request form-data.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Form
Header()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for the request headers.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Header
ModelBinding()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for model binding. Includes form-data, query-string and route data from the request.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource ModelBinding
Path()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for the request url path.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Path
Query()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for the request query-string.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Query
Services()

A Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource for request services.

Return type:Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
public static readonly BindingSource Services

Properties

Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource.DisplayName

Gets the display name for the source.

Return type:System.String
public string DisplayName { get; }
Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource.Id

Gets the unique identifier for the source. Sources are compared based on their Id.

Return type:System.String
public string Id { get; }
Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource.IsFromRequest

Gets a value indicating whether or not the binding source uses input from the current HTTP request.

Return type:System.Boolean
public bool IsFromRequest { get; }
Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource.IsGreedy

Gets a value indicating whether or not a source is greedy. A greedy source will bind a model in a single operation, and will not decompose the model into sub-properties.

Return type:System.Boolean
public bool IsGreedy { get; }