Skip to content

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
: IModelLoader

Package: 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

NameTypeDescription
DbContextModelLoader(IServiceProvider services, Func<IServiceProvider, DbContext> dbContextResolver)voidInitializes a new instance of the Korzh.EasyQuery.Services.DbContextModelLoader class.
DbContextModelLoader(IServiceProvider services, Func<IServiceProvider, DbContext> dbContextResolver, DbContextModelExtractorOptions options)voidInitializes a new instance of the Korzh.EasyQuery.Services.DbContextModelLoader class.
NameTypeDescription
_loggerILogger<DbContextModelLoader>
_optionsDbContextModelExtractorOptions
NameTypeDescription
AdjustExtractorOptions(string modelId, DbContextModelExtractorOptions options)voidAllows 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.