XAT with nested repository actions (submenus)

Aug 2, 2012 at 7:44 AM
Edited Aug 2, 2012 at 7:47 AM

If I have an action:

 

public IQueryable<ManuallyProcessedReceiptNotification> ListManualReceiptNotifications (...) { }

 

Then my XAT finds it and runs fine.

But when I put it in a submenu:

 

[MemberOrder (Name = "Manual Receipting", Sequence = "001")]
public IQueryable<ManuallyProcessedReceiptNotification> ListManualReceiptNotifications (...) { }

 

Then I get:

No Action named 'List Manual Receipt Notifications' (with specified parameters)

My XAT does:

GetTestService ("Receipt Notifications").GetAction ("List Manual Receipt Notifications", typeof (Enums.ManuallyProcessedReceiptNotificationFilter), typeof (DateTime?), typeof (DateTime?));

What must I change to make it work with the submenu?

Coordinator
Aug 2, 2012 at 7:56 AM

GetAction is overloaded, to allow specification of the sub-menu:

 

        ITestAction GetAction(string name);

        ITestAction GetAction(string name, params Type[] parameterTypes);

        ITestAction GetAction(string name, string subMenu);

        ITestAction GetAction(string name, string subMenu, params Type[] parameterTypes);

 

 

Aug 2, 2012 at 8:09 AM

Perfect. Tnx.

Coordinator
Aug 2, 2012 at 8:13 AM
Edited Aug 2, 2012 at 8:14 AM

BTW ...

It isn't (I think) necessary to write:

 

GetTestService ("Receipt Notifications").GetAction ("List Manual Receipt Notifications", typeof (Enums.ManuallyProcessedReceiptNotificationFilter), typeof (DateTime?), typeof (DateTime?));

 

You can just write:

 

GetTestService ("Receipt Notifications").GetAction ("List Manual Receipt Notifications");

 

 Or, with the sub-menu:

GetTestService ("Receipt Notifications").GetAction ("List Manual Receipt Notifications", "Manual Receipting");

I think that the only reason for specifying the parameter types is if there are overloaded actions. However, since the Naked Objects MVC UI (nor, for that matter, the Restful Objects for .NET server) does not support overloaded actions, it is unlikely that you have any.  (The point is that the core  Naked Objects framework can technically support overloaded actions, and the earlier viewers did  -  so this is something we might obsolete).

I'll check the documentation  -  because it is very possible that our own examples unnecessarily show the parameter types being specified.

Try it out on a single example first.  But assuming I'm correct about that then it could save you a lot of coding.

Aug 2, 2012 at 8:20 AM

Awesome. Thanx, that worked.