如何为SQLite行分配字符串作为PrimaryKey? 通常,我使用它来自动增量:
public class BaseItem {
[PrimaryKey, AutoIncrement]
public int Name { get; set; }
}
答案 0 :(得分:0)
你应该可以简单地省略" AutoIncrement"。这就是我们在应用程序中通过设置ctor来实现它的方法:
public class MySuperAwesomeClass
{
[PrimaryKey]
public Guid Key { get; set; }
public MySuperAwesomeClass()
{
Key = Guid.NewGuid();
}
}