Windows Phone:如何排除SQLite net中的列/属性?
如果我使用SQL Server CE for windows phone,我可以选择类的哪些属性映射到数据库表。这允许我在类上具有抽象属性 比如说Windows Phone:如何排除SQLite net中的列/属性?,sqlite,windows-phone-8,sql-server-ce,sqlite-net,Sqlite,Windows Phone 8,Sql Server Ce,Sqlite Net,如果我使用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 NO
[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中的类定义中排除属性?我不能使用扩展,因为其中一些属性被UI绑定使用 如果您正在使用,您可以使用
[Ignore]
属性SQLite本身不包括ORM。你在ORM中使用的是什么?如果你正在使用,你可以使用[Ignore]
属性。就像在库中说的@AlaaMasoud在这种情况下,你需要使用SQLite.IgnoreAttribute
[SQLite.Ignore]public bool isitemidseen{get;set;}
谢谢大家。我正在使用SQLite net作为ORM。对SQLite本身和SQLite net有点混淆。如果你们中有人把这个作为答复,我会接受的。我还更新了这个问题以消除混淆Alaa我在Windows Phone中遇到忽略问题,你知道有什么解决方法吗?