DbContextAttribute 类

定义

标识 DbContext 类所属的 。 例如,此属性用于标识迁移适用于哪个上下文。

[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class DbContextAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type DbContextAttribute = class
    inherit Attribute
Public NotInheritable Class DbContextAttribute
Inherits Attribute
继承
DbContextAttribute
属性

注解

有关详细信息和示例 ,请参阅使用 EF Cor 管理数据库架构

构造函数

名称 说明
DbContextAttribute(Type)

初始化 DbContextAttribute 类的新实例。

属性

名称 说明
ContextType

获取关联的上下文。

适用于