重复映射到列“CustomerID”在“xCustomers”类中
我在下面的类中收到错误重复映射到类“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在 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.