SHARE
TWEET

NHibernate - Mapping a String Foreign Key

a guest Feb 26th, 2012 16 Never
  1. Teams (
  2.  TeamId INT PRIMARY KEY,
  3.  Name VARCHAR(30)
  4. )
  5.  
  6. Players (
  7.  PlayerId INT PRIMARY KEY,
  8.  Team VARCHAR(30)
  9. )
  10.        
  11. <bag name="Players">
  12.     <key column="Team" foreign-key="Name" />
  13.     <one-to-many class="DataTransfer.Player, DataTransfer" />
  14. </bag>
  15.        
  16. <bag name="Players">
  17.    <key column="Team" property-ref="Team" />
  18.    <one-to-many class="Player" property-ref="Team" />
  19. </bag>
  20.        
  21. <many-to-one name="Players" class="DataTransfer.Player, DataTransfer"
  22.              column="Name" property-ref="Team" />
RAW Paste Data
Top