using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Common;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication1.Models {
  public static class ConfigSpecifique {
    public static readonly string DossierTemporaire;
    public static readonly System.Configuration.ConnectionStringSettings CnxECommerce;
    static ConfigSpecifique() {
      DossierTemporaire = System.Configuration.ConfigurationManager.AppSettings["DossierTemporaire"];
      CnxECommerce = ConfigurationManager.ConnectionStrings["DossierTemporaire"];
    }
    public static DbConnection CreerConnexionECommerce() {
      if( CnxECommerce.ProviderName == "System.Data.SqlClient" )
        return new SqlConnection( CnxECommerce.ConnectionString );
      if( CnxECommerce.ProviderName == "System.Data.OleDb" ) 
        return new OleDbConnection( CnxECommerce.ConnectionString );
      throw new NotSupportedException(CnxECommerce.ProviderName);
    }
  }
}