NHibernate - Mapping tagging of entities

Posted by ZNS on Stack Overflow See other posts from Stack Overflow or by ZNS
Published on 2010-03-30T13:08:12Z Indexed on 2010/03/30 13:23 UTC
Read the original article Hit count: 355

Hi!

I've been wrecking my mind on how to get my tagging of entities to work. I'll get right into some database structuring:

tblTag
TagId - int32 - PK
Name

tblTagEntity
TagId - PK
EntityId - PK
EntityType - string - PK

tblImage
ImageId - int32 - PK

tblBlog
BlogId - int32 - PK


class Image
Id
EntityType { get { return "MyNamespace.Entities.Image"; }
IList Tags;

class Blog
Id
EntityType { get { return "MyNamespace.Entities.Blog"; }
IList Tags;


The obvious problem I have here is that EntityType is an identifer but doesn't exist in the database. If anyone could help with the this mapping I'd be very grateful.

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about nhibernate-mapping