Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

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 methodDbModelBuilderVersionAttribute Initializes a new instance of the DbModelBuilderVersionAttribute class.
Top
  NameDescription
Public propertyTypeId (Inherited from Attribute.)
Public propertyVersion Gets 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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.