Hmm, I'm not sure what the intended behaviour is with regards to relationships and deletions, nor what it ideally should be. Will create a few tests on Thursday, will have a chance then.
Generally I'd presume a refresh call to update all fields from the database, or throw an exception if the entity no longer exists in the database. I guess it might be repeating this behaviour for deleted children, which may not be desirable. My framework locks parent entities for editing, preventing the multi-user, multi-session scenario, so I don't think I've ever been in a situation where I've had to refresh an entity that had a modified child collection with deleted entities. Regards Nick -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Alessandro C. Sent: 18 January 2011 04:43 PM To: Castle Project Users Subject: Re: AR Force reload an entity Nicholas thanks for the answer, I realized that my post was not clear. Suppose this: the session1 has load one order and its rows, the session2 has load the same order than the session1, the session2 deletes one row from the order, if you try to refresh the order from session1 it throw an exception because it tries to read the deleted row too. the REFRESH method should discard the order, and all its rows from the session and load again the order and the rows without the deleted one. may be now is more clear. how do you solve this problem in your application? Thanks Alessandro On 14 Gen, 15:52, Nicholas Kilian <[email protected]> wrote: > Can you post some code samples? > > I use entity.Refresh myself with the session-per-winform pattern and > it works fine. > > > > > > > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of Alessandro C. > Sent: 14 January 2011 12:40 AM > To: Castle Project Users > Subject: AR Force reload an entity > > I need to refresh an entity (and all its children) from the database. > I tried ActiveRecordMediator.Refresh(entityname) but nothing happens > on the database and the entity is the same as before. > > I tried ActiveRecordMediator.Evict(entityname) before Refresh but nothing. > > How can I force the entity reload? > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google > Groups "Castle Project Users" 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 athttp://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en.
