I would be inclined to model Order-Product relation as a many-to-many 
association (HasManyToMany). This is implemented in the the DB as a table of 
ProductId and OrderId.  You'd want to make sure the association is lazy, which 
it would be by default.

If I decided to keep just the IDs I would probably use the DelimitedList user 
type that I wrote about before.  That's as good a way as I know to model a 
persisted list of value types. 

On Sunday, May 13, 2012 at 5:24 AM, mynkow wrote:

> But I do not want the order to hold an objects of products. It does not make 
> sense. A simple pointer of type guid is enough.
> 
> So, there is no way to do this with nhibernate?
> 
> On Friday, May 11, 2012 2:01:26 AM UTC+3, Tim Scott wrote:
> > That's right, CustomType is not for creating entity associations.  The type 
> > that I suggested is for mapping a list of things that is stored in a single 
> > database column.  It would work fine for IList<Guid>.  But if what you want 
> > is a one-to-many association, HasMany is the correct way to map that.
> > 
> > 
> > On Thursday, May 10, 2012 at 1:33 PM, mynkow wrote:
> > 
> > > Actually this will not work. I am not able to set custom type for 
> > > ont-to-many or many-to-many.
> > > > > 
> > > > 
> > > 
> > > 
> > > May be I should say that the list of Guids is a list of PKs of product. 
> > > Normally the mapping which is working is
> > > 
> > > HasMany<Product>(x=>x.Products) 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google Groups 
> > > "Fluent NHibernate" group.
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msg/fluent-nhibernate/-/V2mXUTLIoawJ.
> > > To post to this group, send email to fluent-nhibernate@googlegroups.com 
> > > (mailto:fluent-nhibernate@googlegroups.com).
> > > To unsubscribe from this group, send email to 
> > > fluent-nhibernate+unsubscr...@googlegroups.com 
> > > (mailto:fluent-nhibernate+unsubscr...@googlegroups.com).
> > > For more options, visit this group at 
> > > http://groups.google.com/group/fluent-nhibernate?hl=en.
> > 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Fluent NHibernate" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/fluent-nhibernate/-/fKTilMfKW9IJ.
> To post to this group, send email to fluent-nhibernate@googlegroups.com 
> (mailto:fluent-nhibernate@googlegroups.com).
> To unsubscribe from this group, send email to 
> fluent-nhibernate+unsubscr...@googlegroups.com 
> (mailto:fluent-nhibernate+unsubscr...@googlegroups.com).
> For more options, visit this group at 
> http://groups.google.com/group/fluent-nhibernate?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to