Interface IModelRegistry
- Namespace
 - Htmx.Components.Services
 
- Assembly
 - Htmx.Components.dll
 
Provides a contract for registering and retrieving model handlers for different entity types. Model handlers define how entities are displayed, edited, and managed in the UI.
public interface IModelRegistry
  - Extension Methods
 
Methods
GetModelHandler(string, ModelUI)
Retrieves a model handler for the specified type identifier and UI configuration.
Task<ModelHandler> GetModelHandler(string typeId, ModelUI modelUI)
  Parameters
typeIdstringThe unique identifier for the model type.
modelUIModelUIThe UI configuration for the model.
Returns
- Task<ModelHandler>
 A task that represents the asynchronous operation. The task result contains the model handler.
Exceptions
- InvalidOperationException
 Thrown when no model handler is found for the specified type identifier.
GetModelHandler<T, TKey>(string, ModelUI)
Retrieves a strongly-typed model handler for the specified type identifier and UI configuration.
Task<ModelHandler<T, TKey>> GetModelHandler<T, TKey>(string typeId, ModelUI modelUI) where T : class
  Parameters
typeIdstringThe unique identifier for the model type.
modelUIModelUIThe UI configuration for the model.
Returns
- Task<ModelHandler<T, TKey>>
 A task that represents the asynchronous operation. The task result contains the strongly-typed model handler.
Type Parameters
TThe entity type.
TKeyThe type of the entity's primary key.
Exceptions
- InvalidOperationException
 Thrown when no model handler is found for the specified type identifier, or when the handler is not of the expected type.
Register<T, TKey>(string, Action<IServiceProvider, ModelHandlerBuilder<T, TKey>>)
Registers a model handler for the specified entity type with configuration logic.
void Register<T, TKey>(string typeId, Action<IServiceProvider, ModelHandlerBuilder<T, TKey>> config) where T : class, new()
  Parameters
typeIdstringA unique identifier for this model type registration.
configAction<IServiceProvider, ModelHandlerBuilder<T, TKey>>A configuration action that sets up the model handler builder.
Type Parameters
TThe entity type to register a handler for.
TKeyThe type of the entity's primary key.