I can't figure out how to map a table structure like below within fluent nhibernate. Based on how I have the data laid about below you can see that there is no direct relationship between the Transaction or Member table and the CodeSet table. The id goes directly to the CodeValue table. So inside code you will find hardcoded values for the CodeSet tables. This is old code and I don't know if I should just change it or if nHibernate can deal with it.
I have the following tables:
Generic Lookup tables:
CodeSet
ID
Name
Display
CodeValue
ID
CodeSetId
Name
Display
ReferenceValue
I then have tables like
Transaction
ID
TransactionTypeId
Name
Member
ID
FirstName
LastName
MemberTypeId
The TransactionTypeId and MemberTypeId relates back to the CodeValueId on the CodeValue table.
So the data would look like:
CodeSetId Name Display
- 1 "TransactionType" "Transaction Type"
- 2 "MemberType" "Member Type"
CodeValueId CodeSetId Name Display ReferenceValue
- 1 1 ER Visit ER Visit 100
- 2 1 Surgery Surgery 200
- 3 2 Doctor Doctor 500
- 4 2 Patient Patient 600
TransactionId TransactionTypeId Name
- 1 1 Some ER Transaction
- 2 2 Some Surgery Transaction
MemberId FirstName LastName MemberTypeId
- 1 Betty Boo (Doctor) 3
- 2 Sammy Sue (Patient) 4