Поделиться через


DbContextInfo - конструктор (Type, ConnectionStringSettingsCollection)

[Эта страница относится к документации к Entity Framework 6. Последняя версия доступна в составе пакета Entity Framework NuGet. Дополнительные сведения об Entity Framework см. в разделе msdn.com/data/ef.]

Примечание. Данный API устарел.

Инициализирует новый экземпляр класса DbContextInfo, используя указанный тип контекста и настройку строки подключения.

Пространство имен:  System.Data.Entity.Infrastructure
Сборка:  EntityFramework (в EntityFramework.dll)

Синтаксис

'Декларация
<ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")> _
Public Sub New ( _
    contextType As Type, _
    connectionStringSettings As ConnectionStringSettingsCollection _
)
'Применение
Dim contextType As Type 
Dim connectionStringSettings As ConnectionStringSettingsCollection 

Dim instance As New DbContextInfo(contextType, _
    connectionStringSettings)
[ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")]
public DbContextInfo(
    Type contextType,
    ConnectionStringSettingsCollection connectionStringSettings
)
[ObsoleteAttribute(L"The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")]
public:
DbContextInfo(
    Type^ contextType, 
    ConnectionStringSettingsCollection^ connectionStringSettings
)
[<ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")>]
new : 
        contextType:Type * 
        connectionStringSettings:ConnectionStringSettingsCollection -> DbContextInfo
public function DbContextInfo(
    contextType : Type, 
    connectionStringSettings : ConnectionStringSettingsCollection
)

Параметры

  • contextType
    Тип: System.Type
    Тип, являющийся производным от DbContext.

Примечания

Предпочтительным является использование конструктора, который принимает весь документ конфигурации, вместо использования данного конструктора. Предоставление всего документа с конфигурацией позволяет находить в конфигурации записи DefaultConnectionFactory в дополнение к явно заданным строкам подключения.

См. также

Справочник

DbContextInfo Класс

DbContextInfo - перегрузка

System.Data.Entity.Infrastructure - пространство имен