Class SitecoreLayoutModelBinder<T>
- Namespace
- Sitecore.AspNetCore.SDK.RenderingEngine.Binding
- Assembly
- Sitecore.AspNetCore.SDK.RenderingEngine.dll
Implements model binding for Sitecore layout data specified by the SitecoreLayoutBindingSource.
public class SitecoreLayoutModelBinder<T> : IModelBinder where T : SitecoreLayoutBindingSource
Type Parameters
T
The type of the binding source.
- Inheritance
-
SitecoreLayoutModelBinder<T>
- Implements
- Inherited Members
Constructors
SitecoreLayoutModelBinder(IServiceProvider, ILogger<SitecoreLayoutModelBinder<T>>)
Initializes a new instance of the SitecoreLayoutModelBinder<T> class.
public SitecoreLayoutModelBinder(IServiceProvider serviceProvider, ILogger<SitecoreLayoutModelBinder<T>> logger)
Parameters
serviceProvider
IServiceProviderThe IServiceProvider.
logger
ILogger<SitecoreLayoutModelBinder<T>>The ILogger to use for logging.
Methods
BindModelAsync(ModelBindingContext)
Attempts to bind a model.
public Task BindModelAsync(ModelBindingContext bindingContext)
Parameters
bindingContext
ModelBindingContextThe ModelBindingContext.
Returns
- Task
A Task which will complete when the model binding process completes.
If model binding was successful, the Result should have IsModelSet set to
true
.A model binder that completes successfully should set Result to a value returned from Success(object).