重复映射到列“CustomerID”在“xCustomers”类中

发布于 2024-12-11 00:40:51 字数 979 浏览 4 评论 0原文

我在下面的类中收到错误重复映射到类“xCustomers”中的列“CustomerID”,但我不知道我做错了什么。

Public Class xCustomers
    Inherits XPBaseObject

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub

    <Key(True), Persistent("CustomerID")> Private _CustomerID As Integer = -1
    Public Property CustomerID() As Integer
        Get
            Return _CustomerID
        End Get
        Set(ByVal value As Integer)
            SetPropertyValue(Of Integer)("CustomerID", _CustomerID, value)
        End Set
    End Property

End Class

这是 C# 版本

public class xCustomers : XPBaseObject
{

    public xCustomers(Session session) : base(session)
    {
    }

    [Key(true), Persistent("CustomerID")]
    private int _CustomerID = -1;
    public int CustomerID {
        get { return _CustomerID; }
        set { SetPropertyValue<int>("CustomerID", _CustomerID, value); }
    }

}

有什么想法吗?

I get the error Duplicate mapping to column 'CustomerID' in class 'xCustomers' in the following class, but i do not know what am i doing terribly wrong.

Public Class xCustomers
    Inherits XPBaseObject

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub

    <Key(True), Persistent("CustomerID")> Private _CustomerID As Integer = -1
    Public Property CustomerID() As Integer
        Get
            Return _CustomerID
        End Get
        Set(ByVal value As Integer)
            SetPropertyValue(Of Integer)("CustomerID", _CustomerID, value)
        End Set
    End Property

End Class

And here is the C# version

public class xCustomers : XPBaseObject
{

    public xCustomers(Session session) : base(session)
    {
    }

    [Key(true), Persistent("CustomerID")]
    private int _CustomerID = -1;
    public int CustomerID {
        get { return _CustomerID; }
        set { SetPropertyValue<int>("CustomerID", _CustomerID, value); }
    }

}

Any ideas please?

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

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

发布评论

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

评论(1

烂柯人 2024-12-18 00:40:51

您应该在 public int CustomerID 之前添加属性 [Key(true), Persistent("CustomerID")],而不是 private int _CustomerID。

you should add the Attribute [Key(true), Persistent("CustomerID")] before public int CustomerID, not private int _CustomerID.

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