Trouble with Html.ObjectActionAsDialog

May 22, 2013 at 7:33 AM
Morning.
I'm writing a custom view an I'm using the following
@(Html.ObjectActionAsDialog<ReplacementRequest, string> (rr => rr.AddExtra))
On the ReplacementRequest class, the method looks as follows:
public void AddExtra(string description) { ... }
But I am getting this error.
Unable to cast object of type 'System.Linq.Expressions.TypedParameterExpression' to type 'System.Linq.Expressions.ConstantExpression'. 
I'm sure this is not a problem with Naked Objects. But could you share an example of a correct way of using that helper method?

What am I doing wrong?

PS, I based this usage on a project from about 2 or 3 years ago where that syntax did in fact work.
Coordinator
May 22, 2013 at 8:08 AM
Assuming that the model type for the custom view is ReplacementRequest I can't see anything immediately wrong with the syntax you've written. I assume this is an ASPX-style 'run-time compile error' you're getting, rather than a genuine run-time error (if that makes sense!)?

There are multiple overloaded versions of ObjectActionAsDialog and I wonder if it is somehow picking up the wrong one. See if this variant makes any difference:
@(Html.ObjectActionAsDialog<ReplacementRequest, string> (model, rr => rr.AddExtra))
May 22, 2013 at 8:54 AM
Assuming that the model type for the custom view is ReplacementRequest
Yes it is.

Nope, your variation still gives the same error.
Coordinator
May 22, 2013 at 10:17 AM
If you can, set up your VS to pre-compile the view, and see if you can find out which param/type it is complaining about.