DbConfigurationTypeAttribute Class

Definition

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.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
public class DbConfigurationTypeAttribute : Attribute
type DbConfigurationTypeAttribute = class
    inherit Attribute
Public Class DbConfigurationTypeAttribute
Inherits Attribute
Inheritance
DbConfigurationTypeAttribute
Attributes

Remarks

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.

Constructors

DbConfigurationTypeAttribute(String)

Indicates that the subclass of DbConfiguration represented by the given assembly-qualified name should be used for code-based configuration for this application.

DbConfigurationTypeAttribute(Type)

Indicates that the given subclass of DbConfiguration should be used for code-based configuration for this application.

Properties

ConfigurationType

Gets the subclass of DbConfiguration that should be used for code-based configuration for this application.

Applies to