DbModelBuilderVersionAttribute Class

Definition

This attribute can be applied to a class derived from DbContext to set which version of the DbContext and DbModelBuilder conventions should be used when building a model from code--also known as "Code First". See the DbModelBuilderVersion enumeration for details about DbModelBuilder versions.

[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId="Db")]
public sealed class DbModelBuilderVersionAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]
public sealed class DbModelBuilderVersionAttribute : Attribute
type DbModelBuilderVersionAttribute = class
    inherit Attribute
Public NotInheritable Class DbModelBuilderVersionAttribute
Inherits Attribute
Inheritance
DbModelBuilderVersionAttribute
Attributes

Remarks

If the attribute is missing from DbContextthen DbContext will always use the latest version of the conventions. This is equivalent to using DbModelBuilderVersion.Latest.

Constructors

DbModelBuilderVersionAttribute(DbModelBuilderVersion)

Initializes a new instance of the DbModelBuilderVersionAttribute class.

Properties

Version

Gets the DbModelBuilder conventions version.

Applies to