DbContextModelLoader class
Represents a IModelLoader implementation which allows to load the model from a DbContext object. Implements the Korzh.EasyQuery.Services.IModelLoader
public class Korzh.EasyQuery.Services.DbContextModelLoader : IModelLoaderPackage: Korzh.EasyQuery.EntityFrameworkCore.Relational (targets: net10.0, net5.0, net6.0, net8.0, net9.0, netstandard2.0, netstandard2.1)
Assembly: Korzh.EasyQuery.EntityFrameworkCore.Relational.dll
Constructors
Section titled “Constructors”| Name | Type | Description |
|---|---|---|
DbContextModelLoader(IServiceProvider services, Func<IServiceProvider, DbContext> dbContextResolver) | void | Initializes a new instance of the Korzh.EasyQuery.Services.DbContextModelLoader class. |
DbContextModelLoader(IServiceProvider services, Func<IServiceProvider, DbContext> dbContextResolver, DbContextModelExtractorOptions options) | void | Initializes a new instance of the Korzh.EasyQuery.Services.DbContextModelLoader class. |
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
| _logger | ILogger<DbContextModelLoader> | |
| _options | DbContextModelExtractorOptions |
Methods
Section titled “Methods”| Name | Type | Description |
|---|---|---|
AdjustExtractorOptions(string modelId, DbContextModelExtractorOptions options) | void | Allows to adjust the loader options in descendant classes |
LoadModelAsync(DataModel model, string modelId, CancellationToken ct = null) | Task<bool> | Loads the model from the DbContext object that we get from the DI container. NB: The model ID is not actually taking into account since the model is defined by a concrete DbContext type. |