我已经创建了一个新的sqlite表,我很惊讶 - 我的表不空,它有一条记录(id == 1,Title == null)。为什么会这样?
[Table("PurchasesLists")]
public class PurchasesList : INotifyPropertyChanged
{
[PrimaryKey, AutoIncrement, Column("_id")]
public int Id { get; set; }
private string title { get; set; }
public string Title
{
get { return title; }
set
{
if (title != value)
{
title = value;
OnPropertyChanged("Title");
}
}
}
这是一个表创建代码:
SQLiteConnection database;
string databasePath = DependencyService.Get<ISQLite().GetDatabasePath(filename);
database = new SQLiteConnection(databasePath);
database.CreateTable<PurchasesList>();
因此,(from i in database.Table<PurchasesList>() select i).ToList().Count() != 0
感谢任何帮助。