Model-View-Controller an introduction to MVC design pattern with Castle.MonoRail Presentation: v1.0 Prepared by: Chorn Sokun Date: 2008/10/04
Goal Separation of presentation from model Easier to modify either UI or underline business rules Depend on context user can switch between diff. view (html, xml, json etc) Leverage Test-Driven Development Model testing is easier than UI testing Model & UI can be test separately
How It works Model - data & business rules to manipulate the data View – display of model, UI aspect Controller – managing communication between Model and View base on user input UI = View + Controller
MonoRail [ ] An open source web application framework built on top of ASP.NET Using MVC architecture Inspired by Ruby on Rails (Helper, Ajax etc) Adapting convention over configuration Enforcing separation of concerns (SoC) Support Multiple view (template engine) NVelocity – using Velocity template syntax NVelocity Brail – using boo syntax Brail AspView – using webform like (.master)
Basic MonoRail Setup Required Assemblies Castle.Core.dll Castle.MonoRail.Framework.dll Castle.Components.Common.TemplateEngine.dll Castle.MonoRail.Views.Brail.dll Standard Application Layout Views – storing all view template file (.brail,.vm etc) Layouts : master page or site layout Rescues: template for handling errors Controller – controller classes static – store images, javascript, css Models – storing application domain objects
References Model View Controller Pattern – best practice software engineering Model View Controller Pattern Model View Controller – wikipedia.org Model View Controller MonoRail (MR) – Castle MonoRail (.Net) MonoRail (MR) – official castle project website – castle project online collaboration wiki – Tips & Tricks using MonoRail