IJsonObjectBinder Interface
Abblix.Oidc.Server
Abblix.Oidc.Server.Common.Interfaces
IJsonObjectBinder Interface
Provides a mechanism to bind data from a JsonObject to a model, enabling the conversion of JSON data into a strongly typed object. This interface abstracts the process of mapping JSON properties to a model's properties, facilitating the dynamic population of model instances with data from a JSON source.
public interface IJsonObjectBinder
Derived
↳ JsonSerializationBinder
Methods
IJsonObjectBinder.BindModelAsync<TModel>(JsonObject, TModel) Method
Asynchronously binds data from the provided JsonObject to the specified model type. This method allows for the flexible binding of JSON data to C# objects, supporting both the creation of new instances and the population of existing instances.
System.Threading.Tasks.Task<TModel?> BindModelAsync<TModel>(System.Text.Json.Nodes.JsonObject properties, TModel? model=null)
where TModel : class;
Type parameters
TModel
The type of the model to bind. This type must be a class.
Parameters
properties System.Text.Json.Nodes.JsonObject
The JsonObject containing the data to bind to the model.
model TModel
An optional instance of the model to populate. If null, a new instance of TModel will be created.
Returns
System.Threading.Tasks.Task<TModel>
A task representing the asynchronous operation,
which upon completion yields the bound model instance if successful, or null if the binding fails.