{
}
static MapperUtill()
{
try
{
cmdTimeOut = int.Parse(ConfigurationManager.AppSettings["db_timeOut"]);
}
catch
{
cmdTimeOut = 15;
}
try
{
sqlType = int.Parse(ConfigurationManager.AppSettings["sqlType"]);
}
catch (Exception ex)
{
throw ex;
}
//实例化SqlDbMapper
for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++)
{
string key = ConfigurationManager.ConnectionStrings[i].Name;
string value = ConfigurationManager.ConnectionStrings[i].ConnectionString;
CreateMapper(key, value, cmdTimeOut);
}
}
public static ISqlMapper GetSqlMapper(string key)
{
return MapperUtill.GetMapper(key);
}
public static ISqlMapper GetCurrentSqlMapper()
{
return MapperUtill.GetMapper(currentSqlKey);
}
public static void CreateMapper(string connKey, string sqlConStr, int connTimeOut)
{
IDbOperation operation = null;
switch (sqlType)
{
default:
case 0:
operation = new SqlServer(sqlConStr, connTimeOut);
break;
case 1:
//operation = new Orcale(sqlConStr, connTimeOut);//Orcale 未实现
break;
case 2:
//operation = new MySql(sqlConStr, connTimeOut);//MySql 也没有实现呢
break;
2/4 首页 上一页 1 2 3 4 下一页 尾页 |