This project is read-only.
Project Description
Milo is a code generator that take the MVC Model and generates a control class which wraps each model class. These controls can then be used instead of the model. This allows us to simplify the logic in both the views and controllers.

Using Milo makes it easy to:
  • Avoid magic strings
  • Use partial sub views, including canonical naming of <input> tags
  • Do GUI type stuff on model properties in the controller
  • Add actions in the controller rather than the view
  • Probably other stuff

But what is it?
Milo is a combined framework and code generator:
  • The code generator analysises the MVC Model and generates a set on controls classes. These control class expose the model class properties as GUI-like controls
  • The milo framework is used as the basis for the control classes

Use control class in the controller
Customer customer = factory.GetCustomerByCode(id);
CustomerControl control = new CustomerControl(customer);

Render a property in the view
<%= Html.RenderFieldControl(ViewData.Model.Title) %>

Use a partial view to render a object property
<% Html.RenderPartial("Address", ViewData.Model.DeliveryAddress); %>

Set an action link in the controller instead of the view
control.SaveTrigger.AttachTriggerAction<CustomerController>(c => c.Save());

Note that this is very much a demonstration of ideas of the moment. It is neither complete or elegant. However, if there is interest, I think it could evolve into quite a neat tool.

Last edited Apr 7, 2009 at 7:52 AM by mjed, version 3