Comment faire pour ajouter le “Nom du Fournisseur” dans la Chaîne de Connexion dans le fichier de Contexte?

Je suis en Utilisant Entity Framework 5 du Code de la première approche. Voici mon fichier de Contexte :

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";
    }
}

}

Ici, j'ai ajouté la chaîne de connexion dans le constructeur. Mais est-il possible d'ajouter le "Nom du Fournisseur" à la chaîne de connexion?

Votre chaîne de connexion ressemble à SQLClient connection string, de sorte que le fournisseur est SQLClient, nous ajoutons Provider name seulement dans OleDB chaîne de connexion.

OriginalL'auteur raisul | 2013-08-25