私はエンティティフレームワーク5を使用しています。私は、コンストラクタでの接続文字列を追加しました。ここ接続文字列の "プロバイダ名"をコンテキストファイルに追加する方法は?
using IMS.Domain.Inventory;
using IMS.Domain.Security;
using IMS.Domain.StoredProcedures;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IMS.Domain.DBContext
{
public class IMSDBContext : DbContext
{
public DbSet<ModuleAccounting> ModuleAccountings { get; set; }
public DbSet<ModuleInfo> ModuleInfos { get; set; }
public DbSet<ModuleType> ModuleTypes { get; set; }
public DbSet<UserAccounting> UserAccountings { get; set; }
public DbSet<UserGroup> UserGroups { get; set; }
public DbSet<UserInfo> UserInfos { get; set; }
//
// set a connection string
public IMSDBContext() // Constructor of the Context
{
this.Database.Connection.ConnectionString =
"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IMSDB;Data Source=.\\SQLExpress";
}
}
}
:ここに私のコンテキストファイルです。しかし、接続文字列に「プロバイダ名」を追加する方法はありますか?
あなたの接続文字列は 'SQLClient connection string'のように見えるので、プロバイダは' SQLClient'ですので、 'OleDB'接続文字列にのみ' Provider name'を追加します。 –