Firstly, I'll ask my usual question: are you sure you want a
one-to-one?<http://blog.jagregory.com/2009/01/27/i-think-you-mean-a-many-to-one-sir/>
If you still do, then it's the HasOne method you're looking for.
public class UserProfileMap : ClassMap<UserProfile>
{
public UserProfileMap()
{
// your mapping
HasOne(x => x.UserPreferences)
.Cascade.All();
}
}
On Sun, May 24, 2009 at 4:34 AM, [email protected]
<[email protected]>wrote:
>
> Hi,
>
> Can someone direct me on how to create a simple one-to-one mapping.
> Below shows the names of the classes, and the .hbm mappings I used.
> I'm hoping there is a Fluent version of this.. :)
>
> Thanks in advance.
> Greg
>
>
> UserProfile {
> <one-to-one name="UserPreferences" class="UserPreferences"
> cascade="all"/>
> }
>
> UserPreferences {
> <one-to-one name="UserProfile" class="UserProfile"
> constrained="true"/>
> }
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---