DbContextOptionsBuilder.UseModel(IModel) Method

Definition

Sets the model to be used for the context. If the model is set, then OnModelCreating(ModelBuilder) will not be run.

public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseModel (Microsoft.EntityFrameworkCore.Metadata.IModel model);
abstract member UseModel : Microsoft.EntityFrameworkCore.Metadata.IModel -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.UseModel : Microsoft.EntityFrameworkCore.Metadata.IModel -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function UseModel (model As IModel) As DbContextOptionsBuilder

Parameters

model
IModel

The model to be used.

Returns

The same builder instance so that multiple calls can be chained.

Remarks

If setting an externally created model FinalizeModel() should be called first.

See Using DbContextOptions and Model Building for more information and examples.

Applies to