加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows Phone:如何在SQLite-net中排除列/属性?

发布时间:2020-12-14 04:35:15 所属栏目:Windows 来源:网络整理
导读:如果我使用SQL Server CE for Windows phone,我可以选择类映射到数据库表的哪些属性.这允许我在类上具有抽象属性. 例如 [Table]public class MyClass{ // this property is written to the database private int _ItemId; [Column(IsPrimaryKey = true,IsDbG
如果我使用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中的类定义中排除属性?我不能使用扩展,因为UI绑定使用了一些这些属性.

如果您使用的是 SQLite-net,则可以使用[忽略]属性

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读