---
title: "Class BindingExtensions"
slug: "sitecore.aspnet.renderingengine.binding.extensions.bindingextensions"
abstract: ""
---
# Class BindingExtensions

Extensions to support model binding for Sitecore layout data.

## Inheritance

System.Object

BindingExtensions

### **Namespace**: Sitecore.AspNet.RenderingEngine.Binding.Extensions

#### **Assembly**: Sitecore.AspNet.RenderingEngine.dll

##### Syntax

```csharp
public static class BindingExtensions : Object

```

### Methods

#### AddSitecoreModelBinderProviders(MvcOptions)

Adds the default Sitecore model binder providers to the Microsoft.AspNetCore.Mvc.MvcOptions.

##### Declaration

```csharp
public static void AddSitecoreModelBinderProviders(this MvcOptions options)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| Microsoft.AspNetCore.Mvc.MvcOptions | options | The Microsoft.AspNetCore.Mvc.MvcOptions to configure. |

#### GetModelBinder<TSource>(ModelBinderProviderContext)

Gets the [SitecoreLayoutModelBinder<T>](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.binding.sitecorelayoutmodelbinder-1.html) for the specified binding source.

##### Declaration

```csharp
public static BinderTypeModelBinder GetModelBinder<TSource>(this ModelBinderProviderContext context)
    where TSource : SitecoreLayoutBindingSource

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext | context | The Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext instance. |

##### Returns

| Type | Description |
| --- | --- |
| Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder | The Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder instance. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TSource | The type of the binding source. |

#### GetModelBinder<TSource, TType>(ModelBinderProviderContext)

Gets the [SitecoreLayoutModelBinder<T>](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.binding.sitecorelayoutmodelbinder-1.html) for the specified model type and binding source.

##### Declaration

```csharp
public static BinderTypeModelBinder GetModelBinder<TSource, TType>(this ModelBinderProviderContext context)
    where TSource : SitecoreLayoutBindingSource

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext | context | The Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext instance. |

##### Returns

| Type | Description |
| --- | --- |
| Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder | The Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BinderTypeModelBinder instance. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TSource | The type of the binding source. |
| TType | The model type to bind to. |
