使用 Fluent nHibernate 将单个类映射到两个表中的列
我有以下数据库表:
TABLE dbo.Client
(
ClientId PK uniqueidentifier ,
ClientNames VARCHAR(200)
)
TABLE dbo.User
(
userID PK UniqueIdentifier,
password varchar(15),
passwordsalt varchar(15),
ClientID FK uniqueidentifier
)
我想将它们映射到我的类:
public class Client
{
public virtual Guid Id {get;set;}
public virtual string Name {get;set;}
public virtual string password {get;set;}
public virtual string passwordsalt {get;set;}
}
原谅 vb...)
Public Class ClientMap
Inherits ClassMap(Of Client)
Public Sub New()
Me.Id(Function(x) x.Id, "ClientID")
Me.Map(Function(x) x.Name, "ClientNames")
End Sub
End Class
我已将映射排序到客户端表中的位(请 密码盐属性到用户表中的相应列?
预先感谢,
保罗
I have the following database tables:
TABLE dbo.Client
(
ClientId PK uniqueidentifier ,
ClientNames VARCHAR(200)
)
TABLE dbo.User
(
userID PK UniqueIdentifier,
password varchar(15),
passwordsalt varchar(15),
ClientID FK uniqueidentifier
)
I want to map them to my class:
public class Client
{
public virtual Guid Id {get;set;}
public virtual string Name {get;set;}
public virtual string password {get;set;}
public virtual string passwordsalt {get;set;}
}
I've sorted the mapping to the bits in the client table (excuse the vb...)
Public Class ClientMap
Inherits ClassMap(Of Client)
Public Sub New()
Me.Id(Function(x) x.Id, "ClientID")
Me.Map(Function(x) x.Name, "ClientNames")
End Sub
End Class
How do I go about mapping the password & passwordsalt properties to the corresponding columns in the users table?
Thanks in advance,
Pau
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,解决了这个问题...
我的映射文件现在看起来像:
喜欢 VB :o(
Ok, solved this problem...
My mapping file now looks like:
Got to love VB :o(