开发者

NHibernate: Map one to many on unormalized table-structure

开发者 https://www.devze.com 2023-01-09 07:14 出处:网络
I have a table which 开发者_开发百科saves links to documents. The columns are like this: link_id # table_name # table_id # link

I have a table which 开发者_开发百科saves links to documents. The columns are like this:

link_id # table_name # table_id # link

The table_name column contains a reference to an other table and the table_id contains a reference to the PK of the other table.

This means, I have several tables which use this table to save links in a 1:n manner.

In NHibernate, I have several Business Entities which have nothing in common but that they store links in that table. Is there any way to map a One-To-Many relationship on such a table in each of these entities, so that these can contain a list of Links?enter code here


The closest thing that resembles what you're looking for in the NHibernate world is the <any> mapping; you can read more about its usage in this article.

0

精彩评论

暂无评论...
验证码 换一张
取 消