Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top