public int Count <T>(Expression <Func <T, bool> > expression = null)
     where T : class
 {
     using (Connection.Lock())
     {
         return(expression != null?Connection.Table <T>().Where(expression).Count()
                    : Connection.Table <T>().Count());
     }
 }
Example #2
0
        /// <summary>
        /// 导出所有时间标签
        /// </summary>
        public JObject DumpTimeMarks()
        {
            var data   = new JObject();
            var result = _db.Table <TimeMark>().ToList();

            foreach (var timeMark in result)
            {
                data[timeMark.ID] = JsonConvert.SerializeObject(timeMark);
            }

            return(data);
        }
Example #3
0
 public VideoItem GetFromPath(String path)
 {
     using (connection.Lock())
     {
         return(connection.Table <VideoItem>().Where(x => x.Path == path).FirstOrDefault());
     }
 }
Example #4
0
 internal List <Wyniki> getWyniki()
 {
     using (var connection = new SQLiteConnectionWithLock(new SQLitePlatformWinRT(), new SQLiteConnectionString(path2, false)))
     {
         return(connection.Table <Wyniki>().ToList());
     }
 }
 public List <BackgroundTrackItem> LoadPlaylist()
 {
     using (connection.Lock())
     {
         return(connection.Table <BackgroundTrackItem>().ToList());
     }
 }
Example #6
0
        private int GetCurrentVersion()
        {
            _connection.CreateTable <VersionRow>();
            var version = _connection.Table <VersionRow>()
                          .OrderByDescending(x => x.Version)
                          .FirstOrDefault();

            return(version?.Version ?? 0);
        }
Example #7
0
        public AsyncTableQuery <T> Table <T>()
            where T : new()
        {
            //
            // This isn't async as the underlying connection doesn't go out to the database
            // until the query is performed. The Async methods are on the query iteself.
            //
            SQLiteConnectionWithLock conn = GetConnection();

            return(new AsyncTableQuery <T>(conn.Table <T>(), _taskScheduler, _taskCreationOptions));
        }
Example #8
0
        public List <string> SearchIngredients(string query)
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException(nameof(SearchService));
            }
            var q = _parser.Parse(query);

            if (q == null)
            {
                return(new List <string>());
            }
            List <RecipeTextFieldRow> list;

            using (_connection.Lock())
            {
                list = _connection.Table <RecipeTextFieldRow>()
                       .Where(x => x.Type == RecipeTextType.Ingredient && x.Value.Contains(q))
                       .ToList();
            }
            return(list.Select(x => x.Value).ToList());
        }
        public List <Example> GetAllExamples()
        {
            var list = _connection.Table <Example>().ToList();

            return(list);
        }
Example #10
0
 public AlbumItem LoadAlbumFromId(int albumId)
 {
     using (connection.Lock())
     {
         return(connection.Table <AlbumItem>().Where(x => x.Id.Equals(albumId)).FirstOrDefault());
     }
 }
Example #11
0
        public List <QrCodeResult> GetAllQrCodeResults()
        {
            var list = _connection.Table <QrCodeResult>().ToList();

            return(list);
        }