/// <summary> /// Gets the connection. /// </summary> /// <param name="connectionNameEnum">The connection name enum(An enum that has fields /// which named by web.config connection string).</param> /// <returns>New Connection</returns> internal SqlConnection GetConnection(ConnectionNameEnum connectionNameEnum) { var connection = new SqlConnection( System.Configuration.ConfigurationManager. ConnectionStrings[connectionNameEnum.ToString()].ConnectionString); connection.Open(); return(connection); }
/// <summary> /// Gets the connection. /// </summary> /// <param name="connectionNameEnum">The connection name enum(An enum that has fields /// which named by web.config connection string).</param> /// <returns>New Connection</returns> public static SqlConnection GetConnection(ConnectionNameEnum connectionNameEnum) { SqlConnection connection = null; connection = new SqlConnection( System.Configuration.ConfigurationManager. ConnectionStrings[connectionNameEnum.ToString()].ConnectionString); connection.Open(); return(connection); }