3

I have SQLite database in isolated storage in Windows Store App. I use SQLite for Windows Runtime

My class:

[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; }
}

I get data from web server and put it to local DataBase. When I try to store data to DataBase, I handled exeption

 e.message = table Projects has no column named Name 

because DataBase haven't column "Name"

My question is: How to use one class with fields, maping to DataBase Column and simple fields? (I wont not include some fields to DataBase, but I need it in class.)

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?)   

When I try to add System.ComponentModel.DataAnnotations.dll Error: System.ComponentModel.DataAnnotations.dll could not be added. This component is already automaticaly referenced by the build system.

jimpanzer
  • 3,470
  • 4
  • 44
  • 84
  • Which ORM are you using? So form where are the `Table` and `PrimaryKey` etc attributes come from? – nemesv Apr 22 '13 at 14:41

1 Answers1

2

It seems you are using the sqlite-net library in this case you need to use the SQLite.IgnoreAttribute

[SQLite.Ignore]
public string Name { get; set; }
nemesv
  • 138,284
  • 16
  • 416
  • 359