SQLite データベースに保存したカレンダー エントリを並べ替えて、リストビューに表示したいと考えています。SQLite-net-plc で注文するにはどうすればよいですか?
私はただ書くことができると思っていました:.OrderBy<CalendarEntryStartDate>がうまくいかず、SQLite コマンドを使用しようとしましたが、m.db に混乱したため、使用に問題がありました。
using System;
using SQLite;
namespace Stundenplan.Models
{
public class CalendarEntry
{
[PrimaryKey, AutoIncrement]
public int CalendarEntryId { get; set; }
public string CalendarEntryTitle { get; set; }
public string CalendarEntryDescription { get; set; }
[Column("StatDate")]
public DateTime CalendarEntryStartDate { get; set; }
public DateTime CalendarEntryEndDate { get; set; }
public TimeSpan CalendarEntrySpan { get; set; }
public string CalendarEntryParticipants { get; set; }
public string CalendarEntrytLocation { get; set; }
public Boolean CalendarEntryPrivate { get; set; }
public string CalendarEntryTags { get; set; }
public string CalendarEntryColorTag { get; set; }
}
}
using SQLite;
using System.Collections.Generic;
using Stundenplan.Models;
using System.Threading.Tasks;
namespace Stundenplan.Data
{
public class CalendarEntryDatabase
{
readonly SQLiteAsyncConnection calendarentrydatabase;
public CalendarEntryDatabase(string dbPath)
{
calendarentrydatabase = new SQLiteAsyncConnection(dbPath);
calendarentrydatabase.CreateTableAsync<CalendarEntry>().Wait();
}
public Task<List<CalendarEntry>> GetCalendarEntrysAsync()
{
return calendarentrydatabase.Table<CalendarEntry>().ToListAsync();
}
public Task<CalendarEntry> GetCalendarEntryAsync(int id)
{
return calendarentrydatabase.Table<CalendarEntry>().Where(i => i.CalendarEntryId == id).FirstOrDefaultAsync();
}
public Task<int> SaveCalendarEntryAsync(CalendarEntry calendarentry)
{
if (calendarentry.CalendarEntryId == 0)
{
return calendarentrydatabase.InsertAsync(calendarentry);
}
else
{
return calendarentrydatabase.UpdateAsync(calendarentry);
}
}
public Task<int> DeleteCalendarEntryAsync(CalendarEntry calendarentry)
{
return calendarentrydatabase.DeleteAsync(calendarentry);
}
public Task<List<CalendarEntry>> GetCalendarEntriesOrderedByStartDateAsync()
{
return calendarentrydatabase.Table<CalendarEntry>().OrderBy<>;
}
}
}
エラーが発生しました
CS0103: "CalendarEntryStartDate" という名前は現在のコンテキストに存在しません。
と
CS0305: メソッド グループ "OrderBy" (ジェネリック) の使用には、1-Typeargumetns が必要です。
私は何を間違っていますか?