Class Property Not be included as sqlite database column

Shafqat Masood picture Shafqat Masood · May 6, 2013 · Viewed 16.1k times · Source

I have one entity class as

  public class someclass
  {
      public string property1 {get; set;}
      public string property2 {get; set;}
      public string property3 {get; set;}
  }

and using sqlite connection class obj DB I am creating the table

  Db.CreateTableAsync<someclass>().GetAwaiter().GetResult();

What I want to achieve is, I don't want sqlite to create column in the table for property3. Is there any way to achieve this?

I am using SQLiteAsync library for windows store apps.

Answer

chue x picture chue x · May 6, 2013

You can use the Ignore attribute:

public class someclass
{
    public string property1 { get; set; }
    public string property2 { get; set; }
    [Ignore]
    public string property3 { get; set; }
}