Table of Contents

Interface IModelValidator

Namespace
Microsoft.EntityFrameworkCore.Infrastructure
Assembly
Microsoft.EntityFrameworkCore.dll

Validates a model after it is built.

public interface IModelValidator

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Implementation of database providers and extensions for more information and examples.

Methods

Validate(IModel, IDiagnosticsLogger<Validation>)

Validates a model, throwing an exception if any errors are found.

void Validate(IModel model, IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)

Parameters

model IModel

The model to validate.

logger IDiagnosticsLogger<DbLoggerCategory.Model.Validation>

The logger to use.