如何使用 C# 排除 db4o 中持久对象中的属性?

发布于 2024-10-07 06:02:26 字数 41 浏览 0 评论 0原文

由于“[Transient]”实际上对属性不起作用。我现在该怎么办?

Since "[Transient]" does not really work on properties. What do I do now?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝戈者 2024-10-14 06:02:26

db4o 不关心属性。它关心领域。

我猜您正在尝试使用“自动实现的属性”,正确?

在我们改进 db4o 以完全理解自动实现的属性之前,我最好的选择是在这种情况下使用普通属性。

[编辑]

class Item
{
    [Transient] 
    private int serviceLength; 

    public int ServiceLength
    {
       get { return serviceLength; } 
       set { serviceLength = value; } 
    }
}

[/编辑]

我们确实有一个未解决的问题以添加对自动属性的支持。如果这对您很重要,请投票。

最佳

阿德里亚诺

db4o doesn't care about properties. It cares about fields.

I guess you are trying to use "auto-implemented properties", correct?

Until we improve db4o to fully understand auto-implemented properties my best bet is to use normal properties for such cases.

[edited]

class Item
{
    [Transient] 
    private int serviceLength; 

    public int ServiceLength
    {
       get { return serviceLength; } 
       set { serviceLength = value; } 
    }
}

[/edited]

We do have an open issue to add support for automatic properties. If that's important for you, please, vote on it.

Best

Adriano

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文