Monorail Introduction

Embed Size (px)

DESCRIPTION

Showing Monorail functionality with a sample application. Uses Castle Active Record and windsor integration.

Citation preview

  • 1. An Introduction to Monorail.
      • Andrea Magnorsky
    • An Open Source MVCframework

2. Monorail

  • Open Source
  • MVC on top of Asp.Net
  • Separation of Concerns
  • Mature
  • Convention over configuration

3. What am I showing

  • Monorail: MVC framework
  • With a model implemented using Active Record
  • With Windsor integration. Windsor is an inversion of control container.
  • Using Nvelocity as a view engine.
  • Why am I showing all this? Because although they areseparate componentstheywork nicely together.

4. How Monorail works 5. Build it and they will learn it?

  • Twitter App
  • User can send Updates
  • User can follow other users
  • Lets see theDemo

6. Model

  • Uses Active Record
  • Convention over Configuration
  • Default set of operations
  • Works on top of Nhibernate
  • You donthaveto use ActiveRecord.
  • Lets look at thecodefor themodel

* * * 7. Controller

  • Orchestrates the application flow.
  • Convention is Controller ( ieHomeController)

8. Actions

  • Corresponds to methods in the controller.
  • Corresponding view (in Views//) Can be changed
  • Example:/Login/Login.rails

9. Layouts & Rescues

  • Layouts.
    • Not mandatory, use as template.
    • In Views/Layouts
  • Rescues. To Handle exceptions

10. SmartDispatcherController

  • Databinding. Parameters as strongly typed objects

11. Controller

  • Filters.
    • Executed Before or after an action
    • Normally used for Authentication, logging
    • Associated with a controller

12. Controller

  • Helpers
    • Associated with controller. Available in the view.
    • There are many helpers. (FormHelper,UrlHelper)
    • You can create your custom Helper

13. PropertyBag

  • The standard way to pass information from the controller to the view
  • Not Strongly Typed

14. Flash

  • A way to persist information between requests
  • Normally used to retrieve information about an operation to a user, for example on error.

15. Windsor Integration

  • Windsor is an Inversion of Control (IoC) container.
    • Promotes loose coupling
    • Makes you write small classes that have a well defined responsibility.
  • Without the integration you can use windsor (or other IoC) for services, but its more coupled.
  • Without it, controllers coupled to services and possibly IoC container

16. Windsor Integration 17. Windsor Integration 18. Windsor Integration 19. Windsor Integration 20. Controller Testing

  • Careful you don't test the framework
  • Controllers should be skinny

21. Views

  • View Engines
    • Nvelocity
    • Brail
    • AspView
    • Others (contributed by Users)
  • Layouts. Template views that define the layout
  • Rescues

22. Deployment

  • IIS
  • Cassini (only for early development )
  • Monorail can be run on Mono via Apache
  • Some Tweaking normally required
  • Monorail applications can also be run on the cloud (like EC2 instances)
    • Checkhttp://delicious.com/monorail_talkfor more info on how to do this

23. Thanks Links and Q&A

  • Thanks to my friend and colleague Andrew Smith for his help and Advice on this presentation.
  • Questions? You can contact me through my websitehttp://roundcrisis.com
  • Links:
    • http://castleproject.org
    • www.delicious.com/Monorail_talk