Table of Contents

Class DbContextAttribute

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

Identifies the DbContext that a class belongs to. For example, this attribute is used to identify which context a migration applies to.

[AttributeUsage(AttributeTargets.Class)]
public sealed class DbContextAttribute : Attribute
Inheritance
DbContextAttribute
Inherited Members

Remarks

See Managing database schemas with EF Cor for more information and examples.

Constructors

DbContextAttribute(Type)

Initializes a new instance of the DbContextAttribute class.

public DbContextAttribute(Type contextType)

Parameters

contextType Type

The associated context.

Properties

ContextType

Gets the associated context.

public Type ContextType { get; }

Property Value

Type