views:

79

answers:

1

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

A: 

Ok, solved this problem...

My mapping file now looks like:

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

Got to love VB :o(

Paul

related questions