Great, I solved my problems :)

The Customer mapping in License:
ManyToOne(x => x.Customer, m => { m.Column("CustomerId"); m.Unique(true); 
m.Cascade(Cascade.Merge); });

The License mapping in Customer:
OneToOne(x => x.License, m => { m.Constrained(true); 
m.PropertyReference(typeof(License).GetProperty("Customer")); });

The PropertyReference is necessary?

Thanks!

On Wednesday, May 7, 2014 11:11:34 PM UTC+2, Ricardo Peres wrote:
>
> Try OneToOne on one side (Customer to License) and ManyToOne on the other 
> (License to Customer).
>
> RP
>
> On Wednesday, May 7, 2014 8:20:45 PM UTC+1, Matteo Migliore wrote:
>>
>> Hi,
>>
>> here the tables:
>> Customer [Id, Name]
>> License [Id, Name, CustomerId]
>>
>> The classes:
>> class Customer
>> {
>>     Id, Name, License
>> }
>>
>> class License
>> {
>>     Id, Name, Customer
>> }
>>
>> How is the mapping by code? I tried two ManyToOne but it doesn't work.
>>
>> I also need to specify the CustomerId column in the mapping because is an 
>> "exception"
>> the convention for the other tables is ForeignTable_Id so with the 
>> unserscore.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to