BindingSource Class

Summary

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

Syntax

public class BindingSource : IEquatable<BindingSource>

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.ModelBinding.BindingSource

Fields

Body()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for the request body.

public static readonly BindingSource Body
Custom()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for a custom model binder (unknown data source).

public static readonly BindingSource Custom
Form()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for the request form-data.

public static readonly BindingSource Form
Header()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for the request headers.

public static readonly BindingSource Header
ModelBinding()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for model binding. Includes form-data, query-string and route data from the request.

public static readonly BindingSource ModelBinding
Path()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for the request url path.

public static readonly BindingSource Path
Query()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for the request query-string.

public static readonly BindingSource Query
Services()

A [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) for request services.

public static readonly BindingSource Services

Operators

Equality(Microsoft.AspNet.Mvc.ModelBinding.BindingSource, Microsoft.AspNet.Mvc.ModelBinding.BindingSource)
Arguments:
Return type:

System.Boolean

public static bool operator ==(BindingSource s1, BindingSource s2)
Inequality(Microsoft.AspNet.Mvc.ModelBinding.BindingSource, Microsoft.AspNet.Mvc.ModelBinding.BindingSource)
Arguments:
Return type:

System.Boolean

public static bool operator !=(BindingSource s1, BindingSource s2)

Constructors

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

Creates a new [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml).

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)

Properties

DisplayName()

Gets the display name for the source.

Return type:System.String
public string DisplayName { get; }
Id()

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

Return type:System.String
public string Id { get; }
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; }
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; }

Methods

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

Gets a value indicating whether or not the [Microsoft.AspNet.Mvc.ModelBinding.BindingSource](Microsoft.AspNet.Mvc.ModelBinding.BindingSource.yml) can accept data from <paramref name=”bindingSource” />.

Arguments:
Return type:

System.Boolean

Returns:

<c>True</c> if the source is compatible, otherwise <c>false</c>.

public virtual bool CanAcceptDataFrom(BindingSource bindingSource)
Equals(Microsoft.AspNet.Mvc.ModelBinding.BindingSource)
Arguments:
Return type:

System.Boolean

public bool Equals(BindingSource other)
Equals(System.Object)
Arguments:
  • obj (System.Object) –
Return type:

System.Boolean

public override bool Equals(object obj)
Microsoft.AspNet.Mvc.ModelBinding.BindingSource.GetHashCode()
Return type:System.Int32
public override int GetHashCode()