Esempio n. 1
0
        static IItemRepository GetRepository(ConfigData config)
        {
            IItemRepository repository = null;

            if (kernel != null && kernel.ItemRepository != null)
            {
                kernel.ItemRepository.ShutdownDatabase();                                                  //we need to do this for SQLite
            }
            string sqliteDb  = Path.Combine(ApplicationPaths.AppCachePath, "cache.db");
            string sqliteDll = Path.Combine(ApplicationPaths.AppConfigPath, "system.data.sqlite.dll");

            if (File.Exists(sqliteDll))
            {
                try
                {
                    repository = new SafeItemRepository(
                        new MemoizingRepository(
                            SqliteItemRepository.GetRepository(sqliteDb, sqliteDll)
                            )
                        );
                }
                catch (Exception e)
                {
                    Logger.ReportException("Failed to init sqlite!", e);
                    repository = null;
                }
            }

            return(repository);
        }
Esempio n. 2
0
        public SqliteItemRepository GetRepo()
        {
            var path = System.IO.Path.GetFullPath("../../../Sqlite/System.Data.SQLite.dll");

            return(SqliteItemRepository.GetRepository("test.db", path));
        }