【发布时间】:2021-02-23 21:03:56
【问题描述】:
尝试初始化SQLite-NET 数据库时,我不断收到以下错误:
无法创建没有列的表('PersonModel' 有公共属性吗?)
我有一个类 PersonModel 我希望它是不可变的,但是 SQLite 告诉我 PersonModel 必须是可变的,例如每个属性都必须使用public set;。
如何继续使用具有不可变属性的SQLite-NET?
class Person
{
public Person(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public string FirstName { get; } //Read-only Property, cannot be changed after initialization
public string LastName { get; } //Read-only Property, cannot be changed after initialization
}
【问题讨论】:
标签: c# .net sqlite sqlite-net sqlite-net-pcl