我有以下数据库表:
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;}
}
我已经将映射排序到客户端表中的位(请原谅...)
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
如何映射密码& passwordsalt属性到users表中的相应列?
提前致谢,
保罗
答案 0 :(得分:0)
好的,解决了这个问题...
我的映射文件现在看起来像:
Public Sub New()
Me.Id(Function(x) x.Id, "ClientID")
Me.Map(Function(x) x.FullNames, "ClientNames")
Me.Join("Users", AddressOf AddUsersTableInfo)
End Sub
Public Sub AddUsersTableInfo(ByVal m As JoinPart(Of Client))
m.Map(Function(x) x.PasswordSalt, "passwordSalt")
m.Map(Function(x) x.Password, "password")
End Sub
喜欢VB:o(