I am after opinions on an API change to Magellan.
public ActionResult Show(int customerId)
var customer = repository.GetCustomer(customerId);
Model = new CustomerDetailsModel(customerId);
Magellan will then invoke a list of View Engines to track down the view. For example, it will look for:
When it finds a match, it will use the view type to "render" the view. Windows will be shown via
Window.Show(), pages will be navigated to via the
NavigationService, and so on.
What this means from the Controllers point of view however is that the controller action can't be sure what kind of view will get shown; and therefore can't (easily) add view-specific arguments. For example, with a Window, it would be nice to state whether the Window should be shown as a modal dialog or as a non-modal window.
ViewResult class does store a dictionary of custom parameters that the view engines can use. So this means extension methods can easily be used to specify the settings above. For example:
What I don't like about this is we're mixing the generic concept of a view, with the specific concept of a dialog. Which makes the first kind of useless. So I'm considering changing the API's to use more specific results:
Unit testing the controllers will be just as easy as they currently are, but it should make the controllers a little less ambiguous. What do you think?
Update: based on feedback I have gone with the seperate return actions instead of just View(). You'll find this in the latest build.
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.Subscribe