protected void Initialize(bool makeNew, DatabaseBuilder builder)
        {
            if (makeNew)
            {
                builder.CreateDatastore();
            }
            else if (!makeNew && !Exists)
            {
                throw new FileNotFoundException();
            }

            String dbVersion = this.ReadGlobalValue("Database", "Version");
            if (dbVersion != null)
            {
                DatabaseVersion = dbVersion;
            }

            this.SchemaVersion = this.ExecuteScalar<long>("PRAGMA user_version;");
            builder.UpdateDatastore();

            try
            {
                this.LogMessage("File Opened", "normal");
            }
            catch (FMSC.ORM.ReadOnlyException)
            {/*ignore, in case we want to allow access to a read-only DB*/}
        }
        /// <summary>
        /// Creates a DAL instance for a database @ path.
        /// </summary>
        /// <exception cref="ArgumentNullException">path can not be null or an empty string</exception>
        /// <exception cref="IOException">File extension is not valid <see cref="VALID_EXTENSIONS"/></exception>
        /// <exception cref="UnauthorizedAccessException">File open in another application or thread</exception>
        public DAL(string path, bool makeNew, DatabaseBuilder builder) : base(path)
        {
            Debug.Assert(builder != null);
            System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(path), "path is null or empty");

            builder.Datastore = this;

            Path = path;

            this.Initialize(makeNew, builder);
            Logger.Log.V(String.Format("Created DAL instance. Path = {0}\r\n", Path));
        }