Export (0) Print
Expand All

DbConfigurationTypeAttribute 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 placed on a subclass of DbContext to indicate that the subclass of DbConfiguration representing the code-based configuration for the application is in a different assembly than the context type.

System.Object
  System.Attribute
    System.Data.Entity.DbConfigurationTypeAttribute

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

[SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)]
[SuppressMessageAttribute("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
public class DbConfigurationTypeAttribute : Attribute

The DbConfigurationTypeAttribute type exposes the following members.

  NameDescription
Public methodDbConfigurationTypeAttribute(String)Indicates that the subclass of DbConfiguration represented by the given assembly-qualified name should be used for code-based configuration for this application.
Public methodDbConfigurationTypeAttribute(Type)Indicates that the given subclass of DbConfiguration should be used for code-based configuration for this application.
Top

  NameDescription
Public propertyConfigurationTypeGets the subclass of DbConfiguration that should be used for code-based configuration for this application.
Public propertyTypeId (Inherited from Attribute.)
Top

  NameDescription
Public methodEquals (Inherited from Attribute.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Attribute.)
Public methodGetType (Inherited from Object.)
Public methodIsDefaultAttribute (Inherited from Attribute.)
Public methodMatch (Inherited from Attribute.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Top

Normally a subclass of DbConfiguration should be placed in the same assembly as the subclass of DbContext used by the application. It will then be discovered automatically. However, if this is not possible or if the application contains multiple context types in different assemblies, then this attribute can be used to direct DbConfiguration discovery to the appropriate type. An alternative to using this attribute is to specify the DbConfiguration type to use in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information.

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