You need to use a child session to do that. var childSession = e.Session.GetSession(EntityMode.Poco);
On Mon, Sep 27, 2010 at 8:01 PM, Dan <[email protected]> wrote: > I'm having problems getting a delete listener to work. Can a delete > listener handling the delete event of one entity actually delete > another entity? > > I'm getting the same error as mentioned here: > > http://groups.google.com/group/nhusers/browse_thread/thread/ddc8d4f4d80cd1c8/bf79be9a2f6d62c1?#bf79be9a2f6d62c1 > > > On Sep 25, 2:55 am, Ayende Rahien <[email protected]> wrote: > > Hm... > > Good question, probably. > > Although we can't really count on it. Maybe we need to register a delete > > listener in NH instead? > > > > > > > > On Fri, Sep 24, 2010 at 4:04 PM, Dan <[email protected]> wrote: > > > I've written a RemoveOrphanedEntityReference method to > > > AuthorizationRepository that removes the EntityReference if an entity > > > doesn't belong to other EntitiesGroups, and added a call to it in the > > > DetachEntityFromGroup method. This works fine, but would a better > > > approach be to have a RemoveEntity, similar to the RemoveUser method? > > > That is, RemoveEntity wouldn't actually delete the entity, but just > > > removes all information about the entity from the Rhino.Security > > > domain. > > > > > On Sep 23, 9:21 pm, Ayende Rahien <[email protected]> wrote: > > > > Probably not, you might need to do this manually > > > > > > On Thu, Sep 23, 2010 at 10:29 PM, Dan <[email protected]> wrote: > > > > > I'm looking into fixing the bug, not that it is a big deal as even > a > > > > > million orphaned EntityReferences records won't take up that much > > > > > space. > > > > > > > So I've forked the repo and I'm looking at the code in > > > > > AuthorizationRepository and the hbm mapping files. At first I > thought > > > > > it could be solved by a well placed cascade attribute in an hbm > file, > > > > > but the EntityReferences table is kind of a junction table between > > > > > different types of entities and the > EntityReferencesToEntitiesGroups > > > > > table, which is itself a junction table to EntitiesGroups. Do you > > > > > think it is possible for a cascade setting to delete that kind of > > > > > orphan? > > > > > > > Dan > > > > > > > On Sep 22, 4:38 pm, Ayende Rahien <[email protected]> wrote: > > > > > > Looks like a bug > > > > > > > > On Wed, Sep 22, 2010 at 7:50 PM, Dan <[email protected]> wrote: > > > > > > > When I add an entity object to a system I also often associate > the > > > > > > > entity with an entity group. Then when deleting an entity I > first > > > > > > > detach the entity from any groups to which it belongs. This > works > > > in > > > > > > > that I can delete the entity object and the appropriate record > from > > > > > > > EntityReferencesToEntitiesGroups is removed, but associating an > > > entity > > > > > > > to an entity group also enters a record into the > EntityReferences > > > > > > > table, but this record isn't removed when detaching the entity > from > > > > > > > the group or deleting the entity object. > > > > > > > > > Is there something I'm missing when removing an entity from a > > > system > > > > > > > that uses Rhino.Security? > > > > > > > > > There is a RemoveUser method in IAuthorizationRepository that > > > cleans > > > > > > > out any references to an IUser entity object, but is there > > > something > > > > > > > similar for general entities? > > > > > > > > > Thanks > > > > > > > Dan > > > > > > > > > -- > > > > > > > You received this message because you are subscribed to the > Google > > > > > Groups > > > > > > > "Rhino Tools Dev" group. > > > > > > > To post to this group, send email to > > > [email protected]. > > > > > > > To unsubscribe from this group, send email to > > > > > > > [email protected]<rhino-tools-dev%[email protected]> > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > > > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > > > > > . > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/rhino-tools-dev?hl=en. > > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "Rhino Tools Dev" group. > > > > > To post to this group, send email to > [email protected]. > > > > > To unsubscribe from this group, send email to > > > > > [email protected]<rhino-tools-dev%[email protected]> > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rhino-tools-dev?hl=en. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Rhino Tools Dev" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<rhino-tools-dev%[email protected]> > <rhino-tools-dev%2Bunsubscribe@ googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/rhino-tools-dev?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Rhino Tools Dev" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<rhino-tools-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rhino-tools-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" 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/rhino-tools-dev?hl=en.
