如果我使用sql Server CE for
Windows phone,我可以选择类映射到数据库表的哪些属性.这允许我在类上具有抽象属性.
例如
[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; } } }
如果您使用的是
SQLite-net,则可以使用[忽略]属性