nhibernate 中 one to one
时间:2010-09-27 来源:milo yu
看了官方的doc,如下:
<one-to-one name="PropertyName"
(1) class="ClassName"
(2) cascade="all|none|save-update|delete"
(3) constrained="true|false"
(4) fetch="join|select"
(5) property-ref="PropertyNameFromAssociatedClass"
(6) access="field|property|nosetter|ClassName"
(7)/>
(1) |
name: The name of the property. |
(2) |
class (optional - defaults to the property type determined by reflection): The name of the associated class. |
(3) |
cascade (optional) specifies which operations should be cascaded from the parent object to the associated object. |
(4) |
constrained (optional) specifies that a foreign key constraint on the primary key of the mapped table references the table of the associated class. This option affects the order in which Save() and Delete() are cascaded (and is also used by the schema export tool). |
(5) |
fetch (optional - defaults to select): Chooses between outer-join fetching or sequential select fetching. |
(6) |
property-ref: (optional) The name of a property of the associated class that is joined to the primary key of this class. If not specified, the primary key of the associated class is used. |
(7) |
access (optional - defaults to property): The strategy NHibernate should use for accessing the property value. |
看了以后 有点模糊,后来 google了一下,发现有位老兄已经给出了完整示例,在这里我就给出link了
http://www.cnblogs.com/renrenqq/archive/2006/08/16/478198.html