コード例 #1
0
        /// <summary>
        /// Initialization of the engine.
        /// Create a new database or open the existing one.
        /// </summary>
        /// <returns></returns>
        public bool Init(string dbPath)
        {
            // the path should exists
            if (!Directory.Exists(dbPath))
            {
                return(false);
            }

            _dbPath = dbPath;
            string stringConnection = Path.Combine(_dbPath, _dbFileName);

            IEtagairReposit reposit = new EtagairReposit_LiteDB(stringConnection);

            return(base.Init(reposit));
        }
コード例 #2
0
        public static IEtagairReposit CreateRepository_LiteDB(string repositConfig)
        {
            // remove previous db files
            if (FirstCall)
            {
                FirstCall = false;
                RemoveLiteAllDBFiles();
            }

            string stringConnection = @".\Data\lite_" + repositConfig + ".db";

            IEtagairReposit reposit = new EtagairReposit_LiteDB(stringConnection);

            return(reposit);
        }
コード例 #3
0
        static IEtagairReposit CreateRepository_LiteDB(bool removePreviousDBFile)
        {
            string stringConnection = @".\Data\litedb.db";

            // remove the previous one if exists
            if (removePreviousDBFile)
            {
                if (File.Exists(stringConnection))
                {
                    File.Delete(stringConnection);
                }
            }

            IEtagairReposit reposit = new EtagairReposit_LiteDB(stringConnection);

            return(reposit);
        }