private void OpenSqlServerConnection()
        {
            InitializeDataConnection();

            switch (DataConnection.State)
            {
            case ConnectionState.Broken:
                DataConnection.Close();
                DataConnection.Open();
                if (!DataConnectionInfo.IsAcceptableVersion(DataConnection))
                {
                    DataConnection.Close();
                    DataConnectionInfo.ThrowVersionException();
                }
                break;

            case ConnectionState.Closed:
                DataConnection.Open();
                if (!DataConnectionInfo.IsAcceptableVersion(DataConnection))
                {
                    DataConnection.Close();
                    DataConnectionInfo.ThrowVersionException();
                }
                break;
                //default:
                //    break;
            }
        }
        private void InitializeDataConnection()
        {
            if (DataConnection != null)
            {
                return;
            }

            DataConnection = DataConnectionInfo.CreateDbConnection();
        }
 public void ChangeDataConnectionInfo(DataConnectionInfo dataConnectionInfo)
 {
     Close();
     DataConnectionInfo = dataConnectionInfo;
     InitializeDataConnection();
 }
 /// <summary>
 /// Initializes the connection with our custom connectionInfo for whatever
 /// type of database we want to connect to. For now it is SqlServer only.
 /// </summary>
 /// <param name="dataConnectionInfo">IDataConnectionInfo compatible object</param>
 public DataConnectionManager(DataConnectionInfo dataConnectionInfo)
 {
     DataConnectionInfo = dataConnectionInfo;
     InitializeDataConnection();
 }