Tags: ASP.NET MVC, NHibernate, O/R Mappers
With the death of LINQ To SQL and the recent beta release of the ASP.NET MVC Framework, now is a great time to learn about how to use the ASP.NET MVC Framework with NHibernate.
You can download the S#arp Architecture, which is “a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate. The primary advantage to be sought in using any architectural framework is to decrease the code one has to write while increasing the quality of the end product. A framework should enable developers to spend little time on infrastructure details while allowing them to focus their attentions on the domain and user experience.”
Recently S#arp Architecture 0.9 was released with the following enhancements:
- Update of dependencies such as ASP.NET MVC Beta;
- Inclusion of NHibernate.Validator and Fluent NHibernate (no more HBMs...although they're still supported if you love getting your hands dirty in XML);
- A final resolution to Equals and GetHashCode; they're now completely independent from one another;
- Interfaces for DomainObject (was "DomainSignatureComparable") and PersistentObject for rolling your own versions if you'd prefer;
- A greatly simplified Repository interface and with a small addition of GetByProperties (and now being called "Repository" instead of "DAO" to be more inline with DDD nomenclature); the more advanced NHibernate-centric Repository interface is still available for use if needed;
- Support for NHibernate configuration settings being elsewhere than web.config; and
- An extracted DbContext, accessible from any Repository, to access methods such as CommitChanges and RollbackTransaction.
The Northwind sample project code has also been developed further to include:
- Plenty of examples of using Fluent NHibernate in various situations such as one-to-many, many-to-one, many-to-many;
- Inclusion of NHibernate.Validator as the preferred mechanism for performing validation with S#arp Architecture (although other mechanisms may be used); and
- A full CRUD life cycle example (trivial as it may be) for managing basic employee information.
Billy McCafferty is the main developer of S#arp Architecture so check out his blog for announcements and details.
Great stuff!