The whole point of NHibernate as I see it is to stop thinking in tables. You
can create a decent model from pretty much any table structure you want. If
you do it fluently you would have to solve it with HasOne(x =>
x.CreditCard); inside the ClassMap

2009/8/4 Fregas <[email protected]>

>
> Hi,
>
> I'm not sure how to do this in fluent and whether I need HasOne or
> References.  Basically in my tables, I want a one to many relationship
> between the UserAccounts table and the CreditCard table, so that as
> far as the database is concerned, a user could have multiple credit
> cards:
>
> Create table UserAccount
> (
> ID uniqueIdentifier not null,
> Username nvarchar(255)
> ...
> )
>
> create table CreditCard
> (
> ID uniqueidentifier not null,
> NameOnCard nvarchar(255),
> ...
> UserID uniqueidentifier not null
> )
>
> However, in my object model for now, I would like my user account to
> have a reference to a SINGLE credit card, and then have nhibernate
> look up that credit card by the userID in the credit card table.  I
> don't want a CreditCard collection or IList.
>
> Is this possible, or is NH just not setup to do it this way?  If it
> is, how would i map this using Fluent NH?
>
> Thanks,
> Craig
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to