Dave Foster
Dave Foster

Reputation: 51

ASP.NET MVC AsyncController xxxCompleted

When implementing ASP.NET MVC AsyncController the xxxCompleted method has to be Public. I'm wondering if this means the xxxCompleted method can be invoked directly, or if this is protected internally using NonAction or something similar?

Thanks.

Upvotes: 5

Views: 503

Answers (1)

Kev
Kev

Reputation: 119806

Internally (and simplistically), there's an array of MethodInfo of the actions on the async controller constructed. When it's constructed the Async and Completed suffixes are stripped off the action method names.

If you try an call an action method such as IndexCompleted this array is searched but because there isn't an IndexCompleted in the array (because the suffixes have been removed) the AsyncControllerActionInvoker reports that no action was found.

It's worth having a poke around the source code to see for yourself:

ASP.NET MVC 2 RTM on CodePlex

Upvotes: 2

Related Questions