Checking related entities before delete

3 views
Skip to first unread message

Felipe Oriani

unread,
May 14, 2013, 1:29:05 PM5/14/13
to nhu...@googlegroups.com
Hi guys, I have a model with some relations mapped with nhibernate and it is working fine, for sample:

public class A
{
   public int Id { get; set; }
   // other properties

   public ICollection<B> BList { get; set; }
   public ICollection<C> CList { get; set; }
   public ICollection<D> DList { get; set; }
}

The persistence and reading for this kind of entity works very fine, but when the user will delete a A entity, I would like to show him that there are one or more entities relateds (not what entity (id, name etc..) but the what type of entity), for sample:

You cannot delete this register because there are relations with:
-B
-D

(if a A entity, has B's or D's relations and not C's).

I know I can get this information querying entity by entity, but I would like to have a generic solution, Is there any way?!

Thank you



--
______________________________________
Felipe B Oriani
Reply all
Reply to author
Forward
0 new messages