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.

System.Object
  System.Attribute
    System.Data.Entity.DbModelBuilderVersionAttribute

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.

  NameDescription
Public methodDbModelBuilderVersionAttributeInitializes a new instance of the DbModelBuilderVersionAttribute class.
Top

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

  NameDescription
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.)
Top

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.
Show:
© 2014 Microsoft