arrow-left arrow-right brightness-2 chevron-left chevron-right circle-half-full dots-horizontal facebook-box facebook loader magnify menu-down RSS star Twitter twitter GitHub white-balance-sunny window-close
Magellan Extension Points
3 min read

Magellan Extension Points

This is an old post and doesn't necessarily reflect my current thinking on a topic, and some links or images may not work. The text is preserved here for posterity.

Back to: Magellan Home

Darren Neimke pointed me to Simone Chiaretta's useful reference of ASP.NET MVC extension points. Since Magellan's MVC Framework is inspired by ASP.NET MVC, I thought it would be useful reference to draw the connection between the extension points that Magellan supports and highlight some of the key differences.

#ASP.NET MVC Extension PointMagellan Implementation
1 RouteConstraint As Magellan does have the concept of user-visible URL's, routes and routing in general aren't required.
2 RouteHandler As above.
3 IControllerFactory IControllerFactory. Magellan also makes use of controllers, and controller factories manage their life cycle. Releasing works a little differently, but I'm hoping it's an improvement on the model. The documentation on controllers has more information, and there is also a sample on how to use them with IOC containers.
4 ActionInvoker IActionInvoker. Magellan controllers derived from the ControllerBase base class will defer to an IActionInvoker to call the action. The default implementation of IActionInvoker handles action and result filters, uses reflection to locate the methods, and generally works like the ASP.NET MVC equivalent. There is also an asynchronous version.
5 ActionMethodSelectorAttribute This isn't supported in Magellan, though I did consider it. It makes sense in ASP.NET MVC since you are dealing with HTTP requests and public URL's, and you may want to take other HTTP information into account (HTTP verbs are common). Since Magellan is in the rich client world, this isn't a consideration. Since not implementing this feature meant I could keep the implementation simpler, I didn't build it. If this is important, you can derive from the ActionInvoker base class and provide your own selection logic.
6 IAuthorizationFilter ASP.NET MVC draws a distinction between authorization filters and action filters, but the only real difference I've been able to see between them is authorization filters are invoked before action filters. I can think of few reasons why authorization couldn't be implemented with an action filter, so I just went with action filters in Magellan. I'm open to being convinced of why authorization filters should be added.
7 IActionFilter IActionFilter. Magellan supports action filters just like ASP.NET MVC, and they can do most of the same things. They can short-circuit the action, handle exceptions, change the return values, and so on.
8 IModelBinder IModelBinder. Magellan supports model binders too, and the default model binder is used for mapping parameters to actions. However, model binders in ASP.NET MVC exist because you often need to convert raw HTTP input into a rich object. Since Magellan exists in the rich client world, rich objects can be used natively, so I think it would be rare to use model binders. That said, they are supported.
9 ControllerBase ControllerBase and Controller. Controller is the most common base class, but you can derive from ControllerBase if you want to reuse the ActionInvoker usage without the friendly helpers Controller provides. You can also implement IController directly if you wish.
10 IResultFilter IResultFilter. Magellan also supports result filters. They can be used for changing the result, handling rendering exceptions, view reuse, and so on.
11 ActionResult ActionResult. Magellan uses action results as does ASP.NET MVC. The out-of-the-box results support views, cancellation, redirection, and a handful of other features. There's probably less use for custom action results in Magellan than in ASP.NET MVC, but they still come in handy.
12 IViewEngine IViewEngine. View engines are integral in locating and rendering views, so of course they are supported. Magellan ships with three out of the box - one for windows and dialogs, another for pages, and a third for Composite WPF support. I've also shown how to implement a view engine for Windows Forms.
13 HtmlHelper You can probably guess that this doesn't exist in Magellan. Magellan does provide a couple of useful extensions when writing views though, such as navigation behaviors and shared layouts.

Back to: Magellan Home

Paul Stovell's Blog

Hello, I'm Paul Stovell

I'm a Brisbane-based software developer, and founder of Octopus Deploy, a DevOps automation software company. This is my personal blog where I write about my journey with Octopus and software development.

I write new blog posts about once a month. Subscribe and I'll send you an email when I publish something new.