哪个 SQLite.Net.Attributes 忽略对象字段作为列?
Which SQLite.Net.Attributes to ignore object field as Column?
我在 Universal Windows 中使用 Sqlite 和 SQLite.Net-PCL 并且我写了一个 class 用于稍后 table创作:
[Table("my_tab")]
public class MyObj
{
[PrimaryKey, Column("column1")]
public string myObjField1 { get; set; }
[Column("column2")]
public string myObjField2 { get; set; }
//???
public string myObjField3 { get; set; }
}
我的问题是如何忽略 myObjField3
作为 table 列?
您可以只使用 [Ignore]
属性,所以它应该如下所示:
[Table("my_tab")]
public class MyObj
{
[PrimaryKey, Column("column1")]
public string myObjField1 { get; set; }
[Column("column2")]
public string myObjField2 { get; set; }
[Ignore]
public string myObjField3 { get; set; }
}
很简单吧? :)
我在 Universal Windows 中使用 Sqlite 和 SQLite.Net-PCL 并且我写了一个 class 用于稍后 table创作:
[Table("my_tab")]
public class MyObj
{
[PrimaryKey, Column("column1")]
public string myObjField1 { get; set; }
[Column("column2")]
public string myObjField2 { get; set; }
//???
public string myObjField3 { get; set; }
}
我的问题是如何忽略 myObjField3
作为 table 列?
您可以只使用 [Ignore]
属性,所以它应该如下所示:
[Table("my_tab")]
public class MyObj
{
[PrimaryKey, Column("column1")]
public string myObjField1 { get; set; }
[Column("column2")]
public string myObjField2 { get; set; }
[Ignore]
public string myObjField3 { get; set; }
}
很简单吧? :)