Strange mapping requirement

17 views
Skip to first unread message

mynkow

unread,
Jun 18, 2012, 8:15:13 AM6/18/12
to nhu...@googlegroups.com

I have two classes and mapping for the collection:

class User
{
   
Guid ID;
   
string Name;
}

class Group
{
   
Guid ID;
   
string Name;
   
IList<User> Members;
}

// GroupMap
HasMany(x=>x.Members).Inverse().Cascade.AllDeleteOrhpan().etc.

This one works. When I add a User to the Members collection NHibernate cascades the operation. Same for deletes and updates.

Now I want to change my model a bit and this will change also the mapping. The collection is IList<Guid>. What I really want is the cascade to remain. That means that I have to do some custom persister or IUserType. The mapping should tell the object type like HasMany(x=>x.Members) and the collection will hold the IDs

class User
{
   
Guid ID;
   
string Name;
}

class Group
{
   
Guid ID;
   
string Name;
   
IList<Guid> Members;
}

// GroupMap
HasMany<User>(x=>x.Members).Inverse().Cascade.AllDeleteOrhpan().etc.

Any ideas where can I start from? I think that there is no out of the box solution but who knows...


PS: This is cross post: http://stackoverflow.com/questions/11074610/strange-mapping-requirement

Reply all
Reply to author
Forward
0 new messages