public List <Book> GetBooks()
        {
            var sqlSelect = $"select * from {_tableName}";
            var result    = DBSQLiteCommand.ExecuteReader <Book>(sqlSelect, null, (readerItem =>
            {
                var item = new Book();
                item.FromReader(readerItem);
                return(item);
            }));

            return(result);
        }
Beispiel #2
0
        public DBInfo GetInfo()
        {
            var sqlFirst = $"select * from {_tableName} limit 1";
            var result   = DBSQLiteCommand.ExecuteReader <DBInfo>(sqlFirst, null, (readerItem =>
            {
                var item = new DBInfo();
                item.FromReader(readerItem);
                return(item);
            }));
            var info = result.FirstOrDefault();

            return(info);
        }
        public Book GetBook(string id)
        {
            var sqlFirst   = $"select * from {_tableName} where {_columnName_ID} = @id limit 1";
            var parameters = new SQLiteParameter[] { new SQLiteParameter("@id", id) };
            var result     = DBSQLiteCommand.ExecuteReader <Book>(sqlFirst, parameters, (readerItem =>
            {
                var item = new Book();
                item.FromReader(readerItem);
                return(item);
            }));
            var book = result.FirstOrDefault();

            return(book);
        }