Export (0) Print
Expand All

DbModelBuilderVersionAttribute Class

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

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.


Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)]
public sealed class DbModelBuilderVersionAttribute : Attribute

The DbModelBuilderVersionAttribute type exposes the following members.

Public methodDbModelBuilderVersionAttributeInitializes a new instance of the DbModelBuilderVersionAttribute class.

Public propertyTypeId (Inherited from Attribute.)
Public propertyVersionGets the DbModelBuilder conventions version.

Public methodEquals (Inherited from Attribute.)
Public methodGetHashCode (Inherited from Attribute.)
Public methodGetType (Inherited from Object.)
Public methodIsDefaultAttribute (Inherited from Attribute.)
Public methodMatch (Inherited from Attribute.)
Public methodToString (Inherited from Object.)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2014 Microsoft