using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; using System.Data.SqlClient; using System.Web; namespace Bowin.Common.Linq.DB { public class SqlConnectionManager : DbConnectionManager { public static void InitConnections() { CloseConnections(); foreach (ConnectionStringSettings connectionSetting in ((ConnectionStringsSection)(ConfigurationManager.GetSection("connectionStrings"))).ConnectionStrings) { SqlConnection db = new SqlConnection(connectionSetting.ConnectionString); try { db.Open(); } catch {} AddConnection(connectionSetting.Name, db); } IsGlobalConnectionStarted = true; } public static new SqlConnection GetConnection(string contextKey) { if (IsGlobalConnectionStarted) { return (SqlConnection)DbConnectionManager.GetConnection(contextKey); } else { return null; } } } }