我在 Windows Store App 的隔离存储中有 SQLite 数据库。我用SQLite for Windows Runtime
我的课:
[Table("Projects")]
public class Project
{
[PrimaryKey]
[Column ("id")]
public int Id { get; set; }
[Column("group_id")]
public int GroupId { get; set; }
public string Name { get; set; }
}
我从网络服务器获取数据并将其放到本地DataBase
。当我尝试将数据存储到时DataBase
,我处理了异常
e.message = table Projects has no column named Name
因为DataBase
没有列“名称”
我的问题是:如何将一个类与字段、映射DataBase Column
和简单字段一起使用?(我不会包含某些字段DataBase
,但我在课堂上需要它。)
UPD。
using System.ComponentModel.DataAnnotations.Schema;
[NotMapped]
public string Name { get; set; }
Error The type or namespace name 'NotMappedAttribute' does not exist in the namespace 'System.ComponentModel.DataAnnotations.Schema' (are you missing an assembly reference?)
当我尝试添加System.ComponentModel.DataAnnotations.dll
错误时:System.ComponentModel.DataAnnotations.dll could not be added. This component is already automaticaly referenced by the build system
。