I’m finding these tools/technologies to be a great fit for each other. In my application I’m allowing Spring.NET to inject my Dao objects with Spring.NET handling the session management of NHibernate. In addition, each Dao that is used by a MS MVC controller is injected into the controller by Spring.NET.
So my first real test is loading a Company screen with MS MVC. The overall UI design is that each aspect of a company will be viewable using jQuery tabs with a tab view. ie. CompanyInfo, CompanyAddress, CompanyBilling, CompanyBanking, CompanyEmployees, etc… The customer wants quick and easy accesses. They load a company via a simple search and view this information.
To faciliate this, I created a MS MVC view control for each of the above. Each tab renders each control.
Initially I noticed a problem here: with NHibernate lazy-load, the view was making many database calls to populate each tab view, regardless if the tab was even viewed. ie. Billing and Banking info are in the query, and loaded, even if the customer is just looking at ‘company info’.
With some quick and easy jQuery to the rescue and using MS MVC RESTful controller/actions, I was able to solve this problem rather quickly, and quite honestly, I’m very happy with the results. The approach is that jQuery tabs can capture that the user clicks on the tab. When this occurs the data is loaded into a MS MVC control using ajax (the user sees a loading progress indicator) and displayed in the View. This takes advantage of NHibernate lazy load as well. NHibernate will not query out to that object until it’s accessed.
If I get a chance, I’ll include some code snippet and some pretty pictures… Let me know if that would be helpful.