Esempio n. 1
0
        /// <summary>Open the database.</summary>
        public void Open()
        {
            if (FileName == null)
            {
                UpdateFileName();
            }

            if (useFirebird)
            {
                connection = new Firebird();
            }
            else
            {
                connection = new SQLite();
            }

            connection.OpenDatabase(FileName, readOnly: false);

            Exception caughtException = null;

            try
            {
                if (dbReader == null)
                {
                    dbReader = new DataStoreReader();
                }
                dbReader.SetConnection(connection);
            }
            catch (Exception e)
            {
                caughtException = e;
            }
            try
            {
                if (dbWriter == null)
                {
                    dbWriter = new DataStoreWriter();
                }
                dbWriter.SetConnection(connection);
            }
            catch (Exception e)
            {
                caughtException = e;
            }
            if (caughtException != null)
            {
                throw caughtException;
            }
        }