Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone: How do I exclude columns/properties in SQLite-net?

If I use SQL Server CE for windows phone I can select which properties of a class map to database tables. This allows me to have abstract properties on a class.

for instance

[Table]
public class MyClass
{
    // this property is written to the database
    private int _ItemId;

    [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
    public int ItemId
    {
        get
        {
            return _ItemId;
        }
        set
        {
            _ItemId = value;
        }
    }

    // abstract class. obviously this just an example. the real code checks for 11. =)
    // under SQLite, it looks like this will get stored in the db?
    public bool IsItemIdSeven
    {
        get{ return _ItemId == 7; }
    }
}

Is it possible to exclude properties from a class definition in SQLite-net? I can't use extensions as some of these properties are used by UI Bindings.

like image 596
roryok Avatar asked Aug 01 '13 15:08

roryok


1 Answers

If you are using SQLite-net you can use [Ignore] attribute

like image 123
Alaa Masoud Avatar answered Sep 28 '22 07:09

Alaa Masoud