[英]Generic Lookup table using fluent nhibernate
I can't figure out how to map a table structure like below within fluent nhibernate. 我无法弄清楚如何在流畅的hhibernate中映射如下表结构。 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.
根据我下面的数据放置方式,您可以看到Transaction或Member表与CodeSet表之间没有直接关系。 The id goes directly to the CodeValue table.
该ID直接进入CodeValue表。 So inside code you will find hardcoded values for the CodeSet tables.
因此,在内部代码中,您将找到CodeSet表的硬编码值。 This is old code and I don't know if I should just change it or if nHibernate can deal with it.
这是旧的代码,我不知道是否应该更改它或nHibernate是否可以处理它。
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. TransactionTypeId和MemberTypeId与CodeValue表上的CodeValueId相关。
I suggest you read or walkthrough the 'Your first project' in the Fluent NHibernate 'Getting Started' document. 我建议您阅读或浏览Fluent NHibernate“入门”文档中的“您的第一个项目”。
The retail company example has a very similar structure to what you're trying to implement. 零售公司示例的结构与您要实现的结构非常相似。
https://github.com/jagregory/fluent-nhibernate/wiki/Getting-started https://github.com/jagregory/fluent-nhibernate/wiki/入门
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.