
This is the second article in "Implementing MVC Site using Csla and ExtJs". There will be few more! First one can be found at:
Part 1 - Introduction
Unfortunately I have to get through this part and UI before I starttalking about my favorite parts TDD using MVC, Unit Testing in Csla,Design of the DAL in this example to support testability, and newfeatures of Csla 3.6 that support Unit Testing, like ObjectFactory. This part being UI, and how Csla BOs get rendered in MVC app that usesExtJs Ajax library. Fortunate part about that though is that I hopemany of you will find the UI part to be something different and cool!
So lets take a look at the ExtJsMvc solution (image on the left). It includes 3 projects:
- ExtJsCslaDemo.Web (web site)
- ExtJsCslaDemo.Web.Test (Unit tests library built on top of xUnit.net and RhinoMocks)
- Northwind.Data (Linq DAL + few classes that make testing a DAL breeze, on all on top of Northwind sample DB - attached in App_Datafolder)
Key to any Web MVC project are the following 3 folders:
- Controllers (controller classes are in this folder)
- Views (This folder contains all the Views/Pages to be rendered inthis application. Views are grouped in Subfolders that hold the samename as a controller that is in charge of that view. SO for example,you have a Customer subfolder of the Views folder that holds veiws thatthe CustomerController controls - a single veiw called List.aspx).
- Models (This is the place for your BOs that the Views will render- in this example, this is where I placed the Csla classes, butobviously for any solution that ).
As far as controllers our focus is going to be strictly onCustomerController, and OrderController. HomeController is just thedefault one that gets created by the MVC project wizard, andAccountController is the one that takes care of security (login,changing passwords, etc).
When it comes to views just notice that Customer Controller has oneview (List.aspx), while OrderController has no views in the Views/Orderfolder. I will explain that part later in the UI section.
Source for this demo can be found at:
ExtJsDemo.zip (2.58 mb)