Microsoft.EntityFrameworkCore Namespace

Classes

ConventionAnnotatableExtensions

Extension methods for IConventionAnnotatable.

ConventionEntityTypeExtensions

Extension methods for IConventionEntityType.

ConventionForeignKeyExtensions

Extension methods for IConventionForeignKey.

ConventionKeyExtensions

Extension methods for IConventionKey.

ConventionModelExtensions

Extension methods for IConventionModel.

ConventionNavigationExtensions

Extension methods for IConventionNavigation.

ConventionPropertyBaseExtensions

Extension methods for IConventionPropertyBase.

ConventionPropertyExtensions

Extension methods for IConventionProperty.

ConventionTypeBaseExtensions

Extension methods for IConventionTypeBase.

CosmosDatabaseFacadeExtensions

Extension methods for the DatabaseFacade returned from Database that can be used only with the Cosmos provider.

CosmosDbContextOptionsExtensions

Cosmos-specific extension methods for DbContextOptionsBuilder.

CosmosEntityTypeBuilderExtensions

Cosmos-specific extension methods for EntityTypeBuilder.

CosmosEntityTypeExtensions

Extension methods for IEntityType for Cosmos metadata.

CosmosModelBuilderExtensions

Cosmos-specific extension methods for ModelBuilder.

CosmosModelExtensions

Extension methods for IModel for Cosmos metadata.

CosmosPropertyBuilderExtensions

Cosmos-specific extension methods for PropertyBuilder.

CosmosPropertyExtensions

Extension methods for IProperty for Cosmos metadata.

DbContext

A DbContext instance represents a session with the database and can be used to query and save instances of your entities. DbContext is a combination of the Unit Of Work and Repository patterns.

DbContextOptions

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder to create instances of this class and it is not designed to be directly constructed in your application code.

DbContextOptions<TContext>

The options to be used by a DbContext. You normally override OnConfiguring(DbContextOptionsBuilder) or use a DbContextOptionsBuilder<TContext> to create instances of this class and it is not designed to be directly constructed in your application code.

DbContextOptionsBuilder

Provides a simple API surface for configuring DbContextOptions. Databases (and other extensions) typically define extension methods on this object that allow you to configure the database connection (and other options) to be used for a context.

You can use DbContextOptionsBuilder to configure a context by overriding OnConfiguring(DbContextOptionsBuilder) or creating a DbContextOptions externally and passing it to the context constructor.

DbContextOptionsBuilder<TContext>

Provides a simple API surface for configuring DbContextOptions<TContext>. Databases (and other extensions) typically define extension methods on this object that allow you to configure the database connection (and other options) to be used for a context.

You can use DbContextOptionsBuilder to configure a context by overriding OnConfiguring(DbContextOptionsBuilder) or creating a DbContextOptions externally and passing it to the context constructor.

DbFunctionAttribute

Maps a static CLR method to a database function so that the CLR method may be used in LINQ queries. By convention uses the .NET method name as name of the database function and the default schema.

DbFunctions

Provides CLR methods that get translated to database functions when used in LINQ to Entities queries. The methods on this class are accessed via Functions.

DbFunctionsExtensions

Provides CLR methods that get translated to database functions when used in LINQ to Entities queries. The methods on this class are accessed via Functions.

DbLoggerCategory

An API for getting logger categories in an Intellisense/tab-completion friendly manner.

Get an Entity Framework Core logger category using its Name property. For example, LoggerCategory.Database.Sql.Name.

Use these types with IDiagnosticsLogger<TLoggerCategory> or IDiagnosticsLogger<TLoggerCategory> to create a logger.

DbLoggerCategory.ChangeTracking

Logger category for messages from change detection and tracking.

DbLoggerCategory.Database

Logger categories for messages related to database interactions.

DbLoggerCategory.Database.Command

Logger category for command execution, including SQL sent to the database.

DbLoggerCategory.Database.Connection

Logger category for messages related to connection operations.

DbLoggerCategory.Database.Transaction

Logger category for messages related to transaction operations.

DbLoggerCategory.Infrastructure

Logger category for miscellaneous messages from the Entity Framework infrastructure.

DbLoggerCategory.Migrations

Logger category messages from Migrations.

DbLoggerCategory.Model

Logger categories for messages related to model building and metadata.

DbLoggerCategory.Model.Validation

Logger category for messages from model validation.

DbLoggerCategory.Query

Logger category for messages related to queries, excluding the generated SQL, which is in the DbLoggerCategory.Database.Command category.

DbLoggerCategory.Scaffolding

Logger category for messages from scaffolding/reverse engineering.

DbLoggerCategory.Update

Logger category for messages related to SaveChanges(), excluding messages specifically relating to database interactions which are covered by the DbLoggerCategory.Database categories.

DbQuery<TQuery>

A DbQuery<TQuery> can be used to query instances of TQuery. LINQ queries against a DbQuery<TQuery> will be translated into queries against the database.

The results of a LINQ query against a DbQuery<TQuery> will contain the results returned from the database and may not reflect changes made in the context that have not been persisted to the database. For example, the results will not contain newly added views and may still contain views that are marked for deletion.

Depending on the database being used, some parts of a LINQ query against a DbQuery<TQuery> may be evaluated in memory rather than being translated into a database query.

DbQuery<TQuery> objects are usually obtained from a DbQuery<TQuery> property on a derived DbContext or from the Query<TQuery>() method.

DbSet<TEntity>

A DbSet<TEntity> can be used to query and save instances of TEntity. LINQ queries against a DbSet<TEntity> will be translated into queries against the database.

The results of a LINQ query against a DbSet<TEntity> will contain the results returned from the database and may not reflect changes made in the context that have not been persisted to the database. For example, the results will not contain newly added entities and may still contain entities that are marked for deletion.

Depending on the database being used, some parts of a LINQ query against a DbSet<TEntity> may be evaluated in memory rather than being translated into a database query.

DbSet<TEntity> objects are usually obtained from a DbSet<TEntity> property on a derived DbContext or from the Set<TEntity>() method.

DbUpdateConcurrencyException

An exception that is thrown when a concurrency violation is encountered while saving to the database. A concurrency violation occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has been modified since it was loaded into memory.

DbUpdateException

An exception that is thrown when an error is encountered while saving to the database.

EF

Static methods that are useful in application code where there is not an EF type for the method to be accessed from. For example, referencing a shadow state property in a LINQ query.

EntityFrameworkQueryableExtensions

Entity Framework LINQ related extension methods.

EntityTypeExtensions

Extension methods for IEntityType.

ExecutionStrategyExtensions

Extension methods for IExecutionStrategy

ForeignKeyExtensions

Extension methods for IForeignKey.

InMemoryDatabaseFacadeExtensions

In-memory specific extension methods for Database.

InMemoryDbContextOptionsExtensions

In-memory specific extension methods for DbContextOptionsBuilder.

KeyExtensions

Extension methods for IKey.

ModelBuilder

Provides a simple API surface for configuring a IMutableModel that defines the shape of your entities, the relationships between them, and how they map to the database.

You can use ModelBuilder to construct a model for a context by overriding OnModelCreating(ModelBuilder) on your derived context. Alternatively you can create the model externally and set it on a DbContextOptions instance that is passed to the context constructor.

ModelExtensions

Extension methods for IModel.

MutableAnnotatableExtensions

Extension methods for IMutableAnnotatable.

MutableEntityTypeExtensions

Extension methods for IMutableEntityType.

MutableForeignKeyExtensions

Extension methods for IMutableForeignKey.

MutableKeyExtensions

Extension methods for IMutableKey.

MutableModelExtensions

Extension methods for IMutableModel.

MutableNavigationExtensions

Extension methods for IMutableNavigation.

MutablePropertyBaseExtensions

Extension methods for IMutablePropertyBase.

MutablePropertyExtensions

Extension methods for IMutableProperty.

MutableTypeBaseExtensions

Extension methods for IMutableTypeBase.

NavigationExtensions

Extension methods for INavigation.

ObservableCollectionExtensions

Extension methods for ObservableCollection<T>.

OwnedAttribute

Marks a type as owned. All references to this type will be configured as owned entity types.

PropertyBaseExtensions

Extension methods for IPropertyBase.

PropertyExtensions

Extension methods for IProperty.

ProxiesExtensions

Extension methods related to use of proxies with Entity Framework Core.

RelationalCollectionOwnershipBuilderExtensions

Relational database specific extension methods for CollectionOwnershipBuilder.

RelationalDatabaseFacadeExtensions

Extension methods for the DatabaseFacade returned from Database that can be used only with relational database providers.

RelationalEntityTypeBuilderExtensions

Relational database specific extension methods for EntityTypeBuilder.

RelationalEntityTypeExtensions

Extension methods for IEntityType for relational database metadata.

RelationalForeignKeyBuilderExtensions

Relational database specific extension methods for relationship builders.

RelationalForeignKeyExtensions

Extension methods for IForeignKey for relational database metadata.

RelationalIndexBuilderExtensions

Relational database specific extension methods for IndexBuilder.

RelationalIndexExtensions

Extension methods for IIndex for relational database metadata.

RelationalKeyBuilderExtensions

Relational database specific extension methods for KeyBuilder.

RelationalKeyExtensions

Extension methods for IKey for relational database metadata.

RelationalMetadataExtensions

Relational database specific extension methods for metadata.

RelationalModelBuilderExtensions

Relational database specific extension methods for ModelBuilder.

RelationalModelExtensions

Extension methods for IModel for relational database metadata.

RelationalPropertyBuilderExtensions

Relational database specific extension methods for PropertyBuilder.

RelationalPropertyExtensions

Extension methods for IProperty for relational database metadata.

RelationalQueryableExtensions

Relational database specific extension methods for LINQ queries.

RelationalQueryTypeBuilderExtensions

Relational database specific extension methods for QueryTypeBuilder.

RelationalReferenceCollectionBuilderExtensions

Relational database specific extension methods for ReferenceCollectionBuilder.

RelationalReferenceOwnershipBuilderExtensions

Relational database specific extension methods for ReferenceOwnershipBuilder.

RelationalReferenceReferenceBuilderExtensions

Relational database specific extension methods for ReferenceReferenceBuilder.

SqliteDatabaseFacadeExtensions

SQLite specific extension methods for Database.

SqliteDbContextOptionsBuilderExtensions

SQLite specific extension methods for DbContextOptionsBuilder.

SqliteEntityTypeBuilderExtensions

SQLite specific extension methods for EntityTypeBuilder.

SqliteIndexBuilderExtensions

SQLite specific extension methods for IndexBuilder.

SqliteKeyBuilderExtensions

SQLite specific extension methods for KeyBuilder.

SqliteMetadataExtensions

SQLite specific extension methods for metadata.

SqliteNetTopologySuiteDbContextOptionsBuilderExtensions

NetTopologySuite specific extension methods for SqliteDbContextOptionsBuilder.

SqliteNetTopologySuitePropertyBuilderExtensions

SQLite and NetTopologySuite specific extension methods for PropertyBuilder.

SqlitePropertyBuilderExtensions

SQLite-specific extension methods for PropertyBuilder.

SqlitePropertyExtensions

Extension methods for IProperty for SQLite metadata.

SqliteReferenceCollectionBuilderExtensions

SQLite specific extension methods for ReferenceCollectionBuilder.

SqliteReferenceReferenceBuilderExtensions

SQLite specific extension methods for ReferenceReferenceBuilder.

SqlServerCollectionOwnershipBuilderExtensions

SQL Server specific extension methods for CollectionOwnershipBuilder.

SqlServerDatabaseFacadeExtensions

SQL Server specific extension methods for Database.

SqlServerDbContextOptionsExtensions

SQL Server specific extension methods for DbContextOptionsBuilder.

SqlServerDbFunctionsExtensions

Provides CLR methods that get translated to database functions when used in LINQ to Entities queries. The methods on this class are accessed via Functions.

SqlServerEntityTypeBuilderExtensions

SQL Server specific extension methods for EntityTypeBuilder.

SqlServerEntityTypeExtensions

Extension methods for IEntityType for SQL Server-specific metadata.

SqlServerIndexBuilderExtensions

SQL Server specific extension methods for IndexBuilder.

SqlServerIndexExtensions

Extension methods for IIndex for SQL Server-specific metadata.

SqlServerKeyBuilderExtensions

SQL Server specific extension methods for KeyBuilder.

SqlServerKeyExtensions

Extension methods for IKey for SQL Server-specific metadata.

SqlServerMetadataExtensions

SQL Server specific extension methods for metadata.

SqlServerModelBuilderExtensions

SQL Server specific extension methods for ModelBuilder.

SqlServerModelExtensions

Extension methods for IModel for SQL Server-specific metadata.

SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions

NetTopologySuite specific extension methods for SqlServerDbContextOptionsBuilder.

SqlServerPropertyBuilderExtensions

SQL Server specific extension methods for PropertyBuilder.

SqlServerPropertyExtensions

Extension methods for IProperty for SQL Server-specific metadata.

SqlServerReferenceCollectionBuilderExtensions

SQL Server specific extension methods for ReferenceCollectionBuilder.

SqlServerReferenceOwnershipBuilderExtensions

SQL Server specific extension methods for ReferenceOwnershipBuilder.

SqlServerReferenceReferenceBuilderExtensions

SQL Server specific extension methods for ReferenceReferenceBuilder.

SqlServerRetryingExecutionStrategy

An IExecutionStrategy implementation for retrying failed executions on SQL Server.

TypeBaseExtensions

Extension methods for ITypeBase.

WarningConfigurationBuilderExtensions

Relational database specific extension methods for WarningsConfigurationBuilder.

Structs

DbContextId

A unique identifier for the context instance and pool lease, if any.

This identifier is primarily intended as a correlation ID for logging and debugging such that it is easy to identify that multiple events are using the same or different context instances.

RawSqlString

A string representing a raw SQL query. This type enables overload resolution between the regular and interpolated FromSql<TEntity>(IQueryable<TEntity>, RawSqlString, Object[]) and ExecuteSqlCommand(DatabaseFacade, RawSqlString, Object[])

Interfaces

IEntityTypeConfiguration<TEntity>

Allows configuration for an entity type to be factored into a separate class, rather than in-line in OnModelCreating(ModelBuilder). Implement this interface, applying configuration for the entity in the Configure(EntityTypeBuilder<TEntity>) method, and then apply the configuration to the model using ApplyConfiguration<TEntity>(IEntityTypeConfiguration<TEntity>) in OnModelCreating(ModelBuilder).

IQueryTypeConfiguration<TQuery>

Allows configuration for a query type to be factored into a separate class, rather than in-line in OnModelCreating(ModelBuilder). Implement this interface, applying configuration for the query in the Configure(QueryTypeBuilder<TQuery>) method, and then apply the configuration to the model using ApplyConfiguration<TQuery>(IQueryTypeConfiguration<TQuery>) in OnModelCreating(ModelBuilder).

Enums

ChangeTrackingStrategy

Indicates how the context detects changes to properties for an instance of the entity type.

DeleteBehavior

Indicates how a delete operation is applied to dependent entities in a relationship when the principal is deleted or the relationship is severed.

Behaviors in the database are dependent on the database schema being created appropriately. Using Entity Framework Migrations or EnsureCreated() will create the appropriate schema.

Note that the in-memory behavior for entities that are currently tracked by the DbContext can be different from the behavior that happens in the database.

EntityState

The state in which an entity is being tracked by a context.

PropertyAccessMode

Pass a value from this enum to UsePropertyAccessMode(PropertyAccessMode), UsePropertyAccessMode(PropertyAccessMode), or UsePropertyAccessMode(PropertyAccessMode) to change whether the property or backing field will be used when reading and writing to a property or field.

The default behavior is PreferField. Prior to EF Core 3.0, the default behavior was PreferFieldDuringConstruction.

QueryTrackingBehavior

Indicates how the results of a query are tracked by the ChangeTracker.

WarningBehavior

The runtime behavior of warnings generated by Entity Framework