我试图在我的本地SQLite数据库中创建一个表,该数据库是使用https://github.com/praeclarum/sqlite-net
中的库创建的我设法建立了数据库,但是当我通过调用...
添加表格时database.CreateTable<Session>();
...我收到以下错误:
[ERROR] FATAL UNHANDLED EXCEPTION: NUnit.Framework.Internal.NUnitException: Rethrown ---> SQLite.SQLiteException: duplicate column name: PersonNumber
这是我试图存储的课程:
public class Session
{
public Session()
{
}
public Session(string personNumber, Order order, Orderlist orderlist)
{
PersonNumber = personNumber;
Order = order;
SerializedOrder = _orderSerializer.Serialize(Order);
Orderlist = orderlist;
SerializedOrderlist = _orderlistSerializer.Serialize(Orderlist);
}
[PrimaryKey]
public int ID { get; set; }
public string PersonNumber { get; set; }
public string SerializedOrder { get; set; }
public string SerializedOrderlist { get; set; }
[Ignore]
public Order Order
{
get
{
if (Order == null) Order = _orderSerializer.Deserialize(SerializedOrder);
return Order;
}
private set { Order = value; }
}
[Ignore]
public Orderlist Orderlist
{
get
{
if (Orderlist == null) Orderlist = _orderlistSerializer.Deserialize(SerializedOrderlist);
return Orderlist;
}
private set { Orderlist = value; }
}
private static XmlStringSerializer<Order> _orderSerializer = new XmlStringSerializer<Order>();
private static XmlStringSerializer<Orderlist> _orderlistSerializer = new XmlStringSerializer<Orderlist>();
}
答案 0 :(得分:0)
关联:
SDK和用户程序集
跳过链接:
SQLite的网; SQLitePCL.raw