У меня есть база данных SQLite в изолированном хранилище в приложении Windows Store. Я использую SQLite for Windows Runtime
Создайте класс C# со столом. Sqlite-net
Мой класс:
[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
, я обращался Exeption
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
.
Какие ORM вы используете? Итак, откуда взялись атрибуты 'Table' и' PrimaryKey' и т. Д.? – nemesv
Я использую linq для sql. – jimpanzer