Thanks All

This clears it up a bit - like alwin suggested, I'll go with option 1;
though it means more tables in DB.

Since I don't want to p1ss off the DBAs :-)

I was leaning towards the the many-to-any but then querying it without
NHibernate would be tougher.

Thanks again

Ajai

On Jan 17, 9:18 pm, alwin <[email protected]> wrote:
> I would go with option 1: it is the easiest to understand and to
> manage.
> What would be the benefit of option 2 or 3? To me they mostly look
> like extra complexity.
>
> If you want, you could let Page and Product implement ITaggable.
> interface ITaggable {
>  IEnumerable<Tag> Tags{ get; }
>
> }
>
> On 17 jan, 01:25, ajaishankar <[email protected]> wrote:
>
> > Hi
>
> > I'm trying to figure out which is the best way to map the following
> > many to many relation in NH.
>
> > It would be great if you could point me in the right direction.
>
> > In my domain I have unrelated entities that are "taggable".
>
> > Page has many Tags
> > Product has many Tags
>
> > What would be the preferred approach to model this?
>
> > 1. Put each association in its own link table (Page_Tags,
> > Product_Tags)
>
> > 2. Or would it be possible to put all the links in a single link table
> >        Entity_Tags (EntityType, EntityId, TagId)
>
> >       Is this the purpose for <many-to-any> mapping?
>
> > 3. I'm also thinking of deriving everything from a Taggable class -
> > but don't know if that is right
>
> >     In this case everything would be in Taggable_Tags
>
> > Thanks
>
> > Ajai
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.


Reply via email to