using cuidian.Common; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; namespace cuidian.Sql { public class ConnectionUtils { private static ConnectionUtils __instance = new ConnectionUtils(); private Dictionary __maps = new Dictionary(); private ConnectionUtils() { } public static ConnectionUtils Instance { get { return __instance; } } public SqlConnection GetConnection() { return GetConnection(AppSeting.Instance.GetValue("Traget")); } public SqlConnection GetConnection(string key) { SqlConnection con; if (__maps.ContainsKey(key)) return __maps[key]; con = new SqlConnection(AppSeting.Instance.GetConnectstr(key)); //__maps.Add(key, con); __maps[key] = con; return con; } } }