1

I have the following DB schema:

Users
-Id (uniqueidentifier)
-FirstName
-LastName
-Email

AuthProviders
-Id (smallint)
-Name

UserAuthProviders
-Id (uniqueidentifier)
-User (uniqueidentifier, FK)
-AuthProvider (smallint, FK)
-Identity (nvarchar)

I need to map all AuthProviders to the User object. I started with an idbag, but it looks like that only allows me to have an Id, User relationship, and AuthProvider relationship. I need to be able to include the Identity as well.

What else can I use to map it?

Jonas Stawski
  • 6,682
  • 6
  • 61
  • 106

1 Answers1

1

You need to use a many-to-one and a one-to-many, which ends up with 3 classes instead of two. You can eliminate the joining class from your public API, but you'll still have to deal with it in the POCO class internals.

A more complete answer can be found here:

NHibernate many-to-many - how to retrieve property from join table and associate it with a child?

Community
  • 1
  • 1
Kendrick
  • 3,747
  • 1
  • 23
  • 41