简体   繁体   English

NHibernate:映射具有复合ID的一对一关系

[英]NHibernate: Mapping One-toOne Relationship having Composite IDs

We have a situation wherein there is a Parent table and many Child tables. 我们有一个父表和许多子表的情况。 The Parent Table contains all transactions while the child tables are made to segregate specific type of transactions. 父表包含所有事务,而子表用于分隔特定类型的事务。 The key structure is as follows: 关键结构如下:

Parent Table - Contains all Transactions 父表-包含所有交易

  • Composite Primary Key 复合主键
    • TranId 交易编号
    • TranMonth 每月

Children Tables - Contains Transactions of specific type 子表-包含特定类型的交易

  • Composite Primary Key (and also the Foreign Key from Parent table) 复合主键(以及父表中的外键)
    • TranId 交易编号
    • TranMonth 每月

Request someone to help me out on how to map a one-to-one relationship between these tables in NHibernate. 请有人帮我解决如何在NHibernate中映射这些表之间的一对一关系。

您需要在映射中使用Composite id元素-有关示例,请参见此博文

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM