Search code examples
c#sqlitewindows-runtimewindows-store-appssqlite-net

Class Property Not be included as sqlite database column


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.


Solution

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