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.

1
  • Which ORM are you using? So form where are the Table and PrimaryKey etc attributes come from? Commented Apr 22, 2013 at 14:41

1 Answer 1

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; }
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for answer, but I'd try it already. Check updated question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.