Possible enhancement?

Nov 18, 2011 at 8:56 AM

I have a suggestion for a possible enhancement that I would like to raise:

I can write an action that takes an IQueyable<T>. I.e. Call it DeleteItems

When I view an IQueyable<T>, I see a standalone table with checkboxes and an action menu containing my DeleteItems action.

I can check a bunch of T instances and execute the action.  The action will get executed against the checked items in the current page of the standalone table and the items will get deleted.

After the delete action has taken place, I want to be able to return  to the standalone table (with checkboxes and actions) that I just executed the delete from. 

I thought I might be able to do this by returning an IQueryable<T> (minus the deleted T instances) as the return result of the action.  However, whilst this shows me the standalone table, it does not show the checkboxes and actions.

I would suggest that when returning a collection (IQueryable, ICOllection etc) from the result of an action, that the standalone table is displayed in query mode (I.e. with checkboxes and action menu)

 

 

Nov 18, 2011 at 9:39 AM
Stateless architecture. :)
I ran into it also.

http://forum.nakedobjects.net/viewtopic.php?f=1&t=3344

Nov 18, 2011 at 9:41 AM
Edited Nov 18, 2011 at 9:50 AM

Ignore my post.  Just tried it again and it is working if the return type is IQueryable<T>.  I must have tried for ICollection or IEnumerable and not IQueryable.

 

EDIT:

Yep, just tried to do successive deletes and I ran into the error mentioned in the post above.

Coordinator
Nov 18, 2011 at 9:48 AM

You do need to be very careful, though.  Naked Objects adopts the convention that any action returning an IQueryable<T> has no side-effects and may therefore be run multiple times. If, for example, you wrote an action that deleted a number of objects and then returned the remaining objects as an IQueryable, you will soon hit problems because the method definitely has side effects.  See this discussion on our pre-open-source forum:   http://forum.nakedobjects.net/viewtopic.php?f=1&t=3344&p=3755&hilit=Iqueryable#p3755