So you want to learn NHibernate? (or, NHibernate Hyperlink Acupuncture)

July 31, 2008

image NHibernate is a rich and robust open source Object Relational Mapping (ORM) tool. See my preambles to this post for a brief overview of NHibernate and some architectural prerequisites.

NHibernate is currently in version 2.0, which is being billed as a complete (or mostly complete) port of Hibernate version 3.2. That means that in addition to these resources, books and materials relating to Hibernate 3.2 should also apply in large part to NHibernate 2.0.

The Official Documentation & Project Resources

NHForge
Strange name, but promising new NHibernate community website. It is a little lightly populated at the very moment, but this looks like it will be a one stop shop for downloading NHibernate core libraries and the many satellite projects, documentation, etc.

NHibernate Wiki
This is a new resource that was made available along with the release version of NHibernate. I believe the formal NHibernate 2.0 docs live there now.

NHibernate Deep Grok
This funkily-named resource is an app-engine / google-custom-search powered search engine focused entirely on NHibernate. If you need to do an Internet search for NHibernate related material, this is a very good place to start.

NHibernate 1.2 Documentation
A complete reference for NHibernate 1.2, the precursor to 2.0 and the latest official release.

NHibernate Users Forum & E-Mail Discussion List
A Google group / mailing list for asking and responding to NHibernate questions. Invaluable resource. If you haven’t participated in an e-mail list (which is like an e-mail based discussion forum) you should try it, you learn a lot and it is fun.

Source Code On SourceForge
This is the SourceForge home page where you can download the latest releases or, if you have the constitution for it, check out the latest version from the trunk.

The Project Home Page
The official home of the project at hibernate.org.

NH Contrib Project Project Page
The contrib project has some nice components that aren’t part of the core, but are hugely useful anyway. These include LINQ to NHibernate, a validation framework, a session context framework (Burrow) and other good things.

Getting Started

The REAL starting place is here. But if you’ve digested those materials and are ready to start writing some code, check out these resources:

Learn How to use NHibernate with the Summer of NHibernate Screencast
This is a post by Scott Hanselman pointing to the Summer of NHibernate Screencast series. I linked to this post instead of directly to the screencast page because Scott compiles some other learning materials in the post, and provides commentary.

Your first NHibernate based application
Setting up NHibernate 2.0
Using NHibernate as an ORM Solution for .NET

Crucial Community Resources

NHibernate FAQ
This is an NHibernate blog, and a fantastic one at that. A good portion of the links on this page are from that blog – if you are going to develop with NHibernate, you will want to not only subscribe to this blog but take the time to read the archives.

Ayende’s NHibernate Category
This is just a link to the RSS feed for the NHibernate category on Ayende Rahien’s blog (a contributor to NH). Lots of great stuff here.

NHibernate Resharper Plugin
If you use Resharper, this plugin will validate your NHibernate xml mappings.

 

Best Practices & Reference Applications

NHibernate Best Practices with ASP.NET, 1.2nd Ed. – Billy McCafferty
This is a code project article about using NHibernate and a reference app using DDD and an ASP.NET MVP pattern.

S#arp Architecture
This is a CodePlex project providing a reference app and an article included as documentation that provides a reference architecture for using ASP.NET MVC, NHibernate and Castle Windsor. A discussion list for this forum is here.

Foundations of Programming Learning Application
This is an application designed to be a reference app for doing DDD. This also uses ASP.NET MVC and NHibernate.

Code Store Reference App
Another reference app utilizing NHibernate. Also uses Castle Windsor and Tree Surgeon.

How to review a NHibernate application
Ayende’s list of best practices when designing a system using NHibernate.

 

NHibernate 2.0 Announcements & New Features

NHibernate 2.0 Alpha is out!
NHibernate 2.0 Announcement from InfoQ

Rhino Commons

Rhino Commons is part of Rhino Tools, and must be downloaded from the trunk of that project. Rhino Commons is several things ("just a utility library" isn’t one of them) which you can discover for yourself, but one of the things it is is a dash of infrastructure that really smoothes out the wrinkles when working with NHibernate. I can’t tell you how many posts are on the web relating to setting up a UnitOfWork object and managing sessions, or implementing a generic Repository to abstract working with NHibernate sessions. Rhino Commons provides very usable implementations of these concepts. Rhino Tools, by the way, contains a few sample/reference apps for using Rhino Commons as well as NHibernate. Check out Hibernating Forums, for example. Most of these links are about using Rhino Commons with an ASP.NET MVC app. Not sure why that is, but it works for me.

Beginning System.Web.MVC with Rhino Tools, Castle Active Record and Nhibernate, Pt 2, Pt3
RhinoCommons, NHibernate and ASP.NET MVC Part 1, Pt2, Pt3, Pt4, Pt5
NHibernate and the Unit of Work Pattern <–Not strictly about Rhino Commons, but explains the concepts behind it
Adaptive Domain Models with Rhino Commons
AOP With Windsor: Adding Caching to IRepository based on T’s attributes 

Note: In the NHibernate Contrib project is a tool called NHibernate Burrow – it feels to me like the intention of this project and the intention of the session management in Rhino Commons may be the same – but I haven’t dug any further than that. Anyone wish to clarify in the comments?

Misc. Concepts

 

Implementing Frictionless Soft Deletes in NHibernate

Soft Delete in NH

Mapping & Collections

Testing Mappings & Fluid Interface for Mapping 
The above link explores a mechanism to do NHibernate mappings in code instead of XML, giving you all kinds of benefits.

image

[UPDATE] Apparently a full blown open source project has been established to build a fluent interface for doing NHibernate mappings, which is exciting. The project source code repository is here, the Google group / users form is here and a blog post introducing the library and providing a quick start is here.

Mapping Collections in NHibernate (Part 1)
Custom Collections with NHibernate, Part I: Who Cares?
Custom Collections with NHibernate, Part II: The Basics
Custom Collections with NHibernate, Part III: Refactored

Generating / Synchronizing the Database Schema from a NHibernate Model


Create and Update Database Schema

Querying & LINQ to NHibernate
Linq to NHibernate in 10 Minutes
Linq to NHibernate
Kyle Baley – Trying out Linq to NHibernate
My NHibernate 2.0 Supa’ Layer (something new from Rob Eisenberg)

NHibernate Query Generator
[Update (see comments)] NHibernate Query Generator will create strongly typed queries when working with NHibernate using .NET 2.0. LINQ to NHibernate supercedes the NHibernate Query Generator, so if you are working in .NET 3.5, prefer to use LINQ for your strongly typed queries. For .NET 2.0 apps, however, NHibernate Query Generator is a strong alternative.

Lazy Loading & Eager Loading

Lazy Loading – Eager Loading
Eager loading aggregate with many child collections

Entity Joins & Relationships

When to use many-to-one(s) vs. many-to-many with NHibernate
Performing Join Queries with NHibernate CreateAlias

Misc

Audit Options with NH
Integrating Castle Windsor and NHibernate with WCF – Throwing the WCF facility and some Rhino Tools in the mix
Book review: NHibernate in Action
Using Entity-Assigned ID’s

So you want to learn NHibernate – Part 0.5, Prerequisites (or NHibernate = Marijuana.NET)

NHibernate is an Object Relational Mapper (ORM) tool – which is to say it takes your living, squirming objects from a running application and stuffs them into some kind of database. It also will be happy dig into the database, grab some sleeping object, shake it awake and toss it back into your running application when you need it.

As a standalone tool, this can be very useful. It saves you writing a metric ton of SQL, it saves you from having to type out a bunch of tedious boilerplate ADO.NET code to execute that SQL and then find something useful to do with the awkward, pointy data sets and data tables and data readers that are returned.

You can get a lot of mileage from just learning how to use NHibernate, replacing your existing data access code, and leaving it at that. Taking that approach, though, would be leaving a great deal of what NHibernate has to offer on the table. ORM’s such as NHibernate, very much like Inversion of Control containers, are components of a particular kind of loosely coupled, domain centric application design that is all the rage these days (though for very good reasons) called Domain Driven Design (DDD).

For the uninitiated, wholesome, mamma’s boy Microsoft developer picking up a tool like NHibernate or an Inversion of Control Container like Castle Windsor  can often be the first step towards experimenting with Domain Driven Design (championed by the ALT.NET community), introducing you to a different kind of crowd that does things in a different kind of way, much like smoking Marijuana is considered the "gateway drug" to other, "harder" drugs. In the same way that smoking a Marijuana cigarette while listening to your favorite Jazz records with some new friends on Saturday will often lead you to snorting lines of cocaine off of the floor of a public bathroom in a Tijuana brothel on Sunday, learning and using tools like NHibernate will often lead you towards learning a more maintainable, more flexible and generally more fun way of building your software systems.

In concert with Inversion of Control containers, NHibernate supports the concept of "Persistence Ignorance" (PI) – which more or less means that your domain objects have no idea where, how or even that they are being persisted. This dramatically reduces the coupling of your business logic to its infrastructure, which dramatically increases its maintainability, reusability and ultimately its life span. I’m no expert in this field, so I’ll leave it to the experts to do the teaching, but I do feel pretty strongly that before (or in parallel with) learning NHibernate, or any other ORM, it is important to also learn about the kind of architecture it was designed to serve. The resources below should be a very good start:

1. Foundations of Programming – a free e-book by Karl Seguine
This should really be called "An introduction to the ALT.NET approach to Domain Driven Design and Test Driven Development" – it is far more of an introduction to a particular style of building software(despite the "how memory works" chapter) that it is to the foundations of programming in general, but nevertheless it is a very easy to read, very humbly written and very useful introduction to writing modern enterprise software using .NET. If you’re already a grizzled ALT.NET warrior, well you aren’t reading this post, and you probably won’t get much out of this book, but for those of us that don’t fit into that category, I highly suggest reading this short, concise introductory text.

2. Domain Driven Design Quickly
This is a summary of Eric Evan’s seminal book on Domain Driven Design (which you should also read) in the form of a free e-book. This book will get you out of the starting gate. This is much longer than the Foundations of Programming e-book, so you may want to print it out on the old laser jet and take it home.

3. Onion Architecture Part 1, Part 2 and Part3
The name, perhaps, is rather silly, but Jeffrey Palermo does a very nice job of describing how an ideal DDD architecture should be constructed, and how application layers should communicate with one another in contrast to more traditional n-tier architecture.

4. Default Architecture: Layers
A less accessible but still useful post describing how Ayende Rahien (author of Rhino Mocks) approaches his application architecture.

5. NHibernate Best Practices with ASP.NET, 1.2nd Ed.
Despite the title, in this article Billy McCafferty talks quite a bit about application architecture especially as it relates to ORM, Persistence Ignorance and NHibernate, and is definitely worth reading. He has an updated reference architecture which he calls S#arp Architecture, and it is available on Google Code, along with some documentation that contains a hidden gem of morbidly dark humor that is beautifully out of place with the style of the article. I’ll let you find it yourself, but the guide is a good read.

6. Object Relational Impedance Mismatch
This is a useful concept to understand before diving into using an ORM for the first time as well, as it is the Object Relational Impedance Mismatch that NHibernate or any other ORM exists to solve. (For a mild debate/discussion of this see this post and this one). In a nutshell, the "impedance" mismatch is the vast conceptual and structural difference between an object oriented domain model and a table-oriented, set-based relational database. Cramming OO objects into a relational database and the difficulties doing so are the OR Impedance mismatch. FYI, the term "Impedance Mismatch" comes from the EE world, where "impedance" is the resistance of a system to the flow of energy. If energy is to flow consistently from one system to an
other when two systems are connected together, then their "impedance" must be matched or bridged. I suppose in the case of a software system the "energy" is the representation of the state of the domain, and for that representation to flow consistently in between the boundary between an object graph and a relational data store, both with very different levels of resistance to the state representation (the object model having the far smaller impedance)  a mechanism is required to bridge or match the impedance of the two systems, and in the case of NHibernate that mechanism is the ORM toolset.

In the next post I’ll provide specific links to NHibernate resources that I’ve found to help actually learn the tool.

So you want to learn NHibernate – Part 0, Overview

Why?
For the past several years we have been using a home grown ORM tool as part of a larger application framework. It works pretty well, but there are a few drawbacks:

  • It’s home grown – unless we divert attention from building our business applications, it stays frozen in time. This is a drawback of every home grown tool, and why a community or third party library should always be considered when good ones are available.
  • It’s tied to SQL Server. Getting it to run on another database platform would be quite a bit of work.
  • No LINQ support, in fact, no query language of any kind. When we want custom queries, we put them in our model editor and generate new code. This get’s us a method on our DAL to execute the query, but that means there is this whole open-model-editor, make change, generate code, compile code and test cycle for every little query we may need.
  • As an internal tool, it is rather poorly documented. Training new developers requires using in-house staff. No pointing to a list of links on the web and saying, “here, go learn this and we’ll get started”
  • It means nothing when you put it on a resume :)

As we are embarking on a new set of projects, the time seems right to consider the possibility of moving to a mainstream ORM tool with a healthy community and plenty of learning material. I won’t go through the selection process, but we looked at some commercial tools and we looked at NHibernate, and while the commercial tools have some nice polish on them and comprehensive documentation, the community surrounding NHibernate is so vibrant (and so distinguished) that we’re strongly leaning in that direction.

NHibernate does lack some polish. It’s an engine that requires some build-out of infrastructure to make it comfortable to use, but much of that build out has been contributed by community members and where it hasn’t, the blogosphere has filled the gaps with any number of helpful walk-through’s and best practices posts. I’ll post links to the resources I’ve identified in a subsequent post.

Active Record
Perhaps the most prominent of these community contributed build-outs is the oh-so-famous ActiveRecord implementation that is part of the Castle Project. NHibernate, in its raw, unprocessed form, handles persisting Plain Old CLR Objects (POCO’s) to a persistence medium by way of XML mapping files which must be hand crafted. The mapping file contains which fields of a persistent object will be stored to the database, and can control every detail of the mapping between a field and a corresponding database column. The mappings also communicate to NHibernate how entities relate to one another, such as many-to-one, many-to-many, etc.

All this is very powerful, but perhaps not so much fun to manage (although many people prefer to do so manually). Active Record is a design pattern for object relational mapping that maintains one Class for each Table in a data store, more or less, and Castle Windsor provides an implementation of this pattern such that a combination of Convention over Configuration and .NET Attributes remove the need for creating and maintaining NHibernate mapping files. In fact, when you use Castle’s ActiveRecord, you may not know you’re using NHibernate at all as the whole experience is nicely abstracted. To make this happen it is understood when you use Active Record your objects will be saved to the database in a certain way, and you are OK with that, because it saves you many small decisions and many XML code edits.

Whether or not to use ActiveRecord is, I think, largely a matter of taste and your personal relationship with Convenience(Cost) vs Control, the yin and yang of the Build vs Buy decision. We haven’t settled on ActiveRecord yet, although we are pretty sure that if we don’t use ActiveRecord, we’ll be rolling our own code generator to maintain both NHibernate Mapping Files and the Database Schema, and possibly the Entity classes themselves, based on a metadata model. Maintaining a few trillion XML mapping files doesn’t sound like a lot of fun to me.

Next I’ll talk a little about architecture, and then drown you in NHibernate hyperlinks.

To (ASP.NET)MVC or not to MVC (or, ASP.NET MVC Hyperlink Acupuncture)

July 29, 2008

Currently, we are struggling with a decision as we stand at the edge of a new project and attempt to divine the future. Here are a few chicken bones, in the form of links:

Jeff Atwood is working with MVC, and is bothered by what he feels is the re-introduction of Tag Soup. Rob Conery begs to differ, and makes the case that if you are careful and organized you can easily avoid Tag Soup, and instead prepare a delicious Tag Cobbler. In the comments, readers suggest you can do Tag Cobbler one better and have yourself a nice, orderly, maintainable Tag Cake with some of the alternate view engine integrations provided in the MvcContrib project. (Or, maybe you like SharpTemplate.NET for its flexibility, but are dismayed that there is no default MVC integration in MvcContrib. Don’t worry, it is trivial to create the integration yourself.)

One of the most significant concerns with leaving your old ASP.NET station wagon running at a red light and jumping into the sexy new MVC convertible with  image imagethe hot blonde making eyes at you from the turning lane is the lack of rich UI controls for MVC. Classic ASP.NET may have drawbacks, of course, but one of its great strengths is the breadth of very well made user interface components to turn your ugly developer sensibilities into a beautiful and modern masterpiece in a plug n’ play way. We use Telerik controls here, but they aren’t ready to commit to an MVC suite yet. There is some advice on how to use user controls in ASP.NET MVC (and other ways to gracefully render content in MVC), but it will likely take some time before rich UI components are available for MVC, the framework is just so different. In the mean time you can make some third party controls work with MVC if they will function without postbacks or viewstate, and there is no particular reason your MVC application can’t link to a standard ASPX page with a full lifecycle if you only have a few places where you need some particularly web forms dependant control.

Another approach to server controls, though, is DHTML controls. There are a number of vendors and open source frameworks that provide rich grids, tree views, etc. purely using JavaScript and AJAX. These should work just fine with MVC without modifications. However, this won’t cover all your bases. For instance, I haven’t had much luck finding a Javascript calendaring / scheduling suite that can even come close to the server-control based Telerik or DevExpress offerings.

If you choose ASP.NET MVC

If you want to use jQuery to facilitate your AJAXiness, check out this blog post and associated download. And this one and subscribe to this blog. If you want to use jQuery for validation using MVC, read this. You may also want model-based validation that works server side AND client side. Here is a post providing links to both client side and server side validation techniques.

If you end up using the excellent extJS suite of JavaScript controls, you should check out Coolite, which wraps the extJS library with ASP.NET controls and will have MVC support shortly, and the project extsharp that uses Script#, a library that allows you to compile C# into JavaScript, to product a C# object model for working with extJS controls.

You will also want to check out the S#arp Architecture project on CodePlex by Billy McCafferty. This is a reference architecture for building an enterprise ASP.NET MVC application in a modern, domain driven style using NHibernate 2.0 as the ORM and dependency injection via Castle Windsor. I’m still in the process of going through the documentation, but this looks like a really solid place to start if you’re building an app from scratch. If you go the NHibernate route, take a look at this series of posts about using NHibernate, ASP.NET MVC, and Rhino Commons.

You’ll also want to follow the excellent blogs of Stephen Walther, Scott GuthrieJeffrey Palermo (who is writing a book for Manning on ASP.NET MVC, which you can read as its written via their
Early Access Program) and Rob Conery (who has produced quite the library of screencasts on building an ASP.NET MVC application using TDD). Oh, and Maarten Balliauw seems to have consistently high quality posts on MVC as well. He even came up with a nifty MVC Extension method to render a Data Grid with paging and editing capabilities using an extension method. Pretty slick.

ASP.NET MVC Lives Here, with helpful relatives in the granny unit, and has a summer home here.

[Update] There is an ASP.NET MVC “News, Announcements and Information”, aka buzz site, here at aspdotnetmvc.com that acts as a sort of giant ear to the ground picking up and aggregating any and all things MVC that pop up on the web. I don’t think it is just a dumb aggregator, though, I think it is human-filtered, so it is probably a good place to visit frequently or a good starting point for MVC research. I tried subscribing to the RSS feed once, but was almost immediately blown out of my seat by volume of aggregated posts, so I un-subscribed. But if you’re working with ASP.NET MVC, I’m pretty sure you’ll want this site on your short list of bookmarks, or, if you can withstand the torrent, you might even want to subscribe.

Want to create some services using MVC? Read this and this.

Want to create reusable controls for MVC? Read this and this.

Want to add HTTPS/SSL support to ASP.NET MVC routing? Here it is.

Want to run an ASP.NET MVC using an embedded web server as a desktop app? No? I don’t believe you. Read this.

For good measure, also check out this Digg clone built using ASP.NET MVC. They call it Kigg, so that you can’t say it out loud without feeling silly.

Steven Walther is building the self proclaimed Best Forum Application IN THE WORLD based on MVC. This is an ongoing series, currently at post 4 1/2. See
Part 1, Part 2, Part 3 , Part 4 and Part 4/12. In addition to technical MVC discussion, the series opens up with a very nice, ALT.NETy discussion of the the best way (from a process / practice point of view) to go about building the best forum app in the world.

You’ll probably also want to check out BlogSvc.net, and open source Blog Engine built using ASP.NET MVC. This is not a sample app but a full blown blogging platform that is built on AtomPub and uses LINQ, jQuery and other cool technology. The project website is here and the Codeplex home page is here.

More recently, Maarten Balliauw has posted another end to end sample called Car Trakkr, which is built on the Beta 1 release, so it’s nice and fresh.

 

If you stick with ASP.NET Web Forms

But you covet the pretty little .aspx-less URLs of MVC, read this.

Web Forms and MVC are not the only patterns on the block, BTW

Don’t forget about MVP. Many people prefer MVP (Model View Presenter) over MVC, and while the frothy, drunken buzz over ASP.NET MVC is rather deafening, there is a lot of support for doing MVP in ASP.NET, numerous open source frameworks supporting it, and it might be a good middle ground between the two approaches. If you’re going to use DDD and NHibernate and are interested in MVP, read this article and check out the “Enterprise Sample” that is included. Also by the same author (and the author of S#arp Architecture noted above) is this Code Project article and associated samples about building an MVP app in ASP.NET. Interestingly, the author has amended the article to recommend against rolling your own MVP, but if you choose the pattern, this is a good article to read anyway. Kyle Baley, the Coding Hillbilly, discusses how the redneck community views the difference between MVC and MVP.

You may also like to read this article about choosing a web framework for .NET.

And, lo and behold, Wordpress found this for me in the “this might be related” section: ASP.NET MVC vs Web Client Software Factory (which is MVP based)

Don’t Forget about Castle Monorail

And of course, ASP.NET MVC is the new kid on the block. The open source framework Castle Monorail has an established, mature MVC framework for ASP.NET. Interestingly the founder of Castle is going to work for Microsoft, but not for the ASP.NET MVC team.

Let me know if I left out anything critical, or you know of any good write-ups on the various options and the tradeoffs between them.

The Eye of Sauron (or, driving traffic to your blog by tickling a sneezer)

July 19, 2008

This is a blog with pretty modest traffic. imageEven so, I keep an eye on the stats, as I’m sure just about everyone who keeps a blog does. Recently I posted a list of .NET utility libraries and mis-categorized Ayende’s Rhino Commons by including it in that list. Ayende then posted a very short entry in his blog setting the record straight, but linking back to my original post. Suddenly, traffic  went through the roof. Like I said, we don’t get many spectators here, so it was a rather dramatic event. It reminded me of Lord of the Rings, and I felt like I had unwittingly “put on the ring.” I wonder what it feels like to command that kind of attention, such that if you look in one direction thousands of others all turn their heads at the same time to follow your gaze.

The moral of the story is this: if you have a blog you are trying to grow, cover it glue using the techniques described here and here, and then annoy Ayende (or another powerful sneezer). Of course, you don’t have to annoy them, impressing them enough to link to your post would be just as effective, but that is much harder to do. Tragically, I was taken quite by surprise, so there was no time to get out the glue.

Another Short, Free E-Book on a vital Topic – Service Oriented Architecture, Getting it Right

July 16, 2008

Implemntors Guide to SOAUltimately, I imagine we have Seth Godin to thank for all these wonderful, free books. Here is another one – this one is about implementing SOA, and from Joe McKendrick’s description, it is part implementation guide, part inspiration to get started now, not wait for the mythical day when your organization’s blueprints for the Hanging Gardens of Babylon of enterprise architecture are finally complete.

The e-book is available as a free download here, and a print version can be purchased for $20.00 here.

Content Management Systems (CMS) for the .NET Platform

Currently we’re in the process of planning a rewrite of our vertical market portal system, delivered as SaaS, in order to bring it out of the stone ages of ASP.NET 1.0 and into to something a bit more modern, mostly so that it doesn’t feel so awkward mixing with our other, more cutting edge applications during customer demos and office integration parties. (We’re sensitive like that).

Anyway, building a portal system from scratch is tempting from a technologists point of view, but a bit silly from a business standpoint as the "portal" has been solved a few trillion times already using every web-capable technology known to man, ASP.NET included.

Choosing a CMS from the perspective of a SaaS vendor looking for a development platform to build a niche product and deliver it using flexible pricing models (including free, at times) is no easy task.

There are three major challenges in this process:

  • Flooded CMS Market: The sheer quantity of CMS systems for sale or for free. True, only a few rise to the top, but it takes a lot of sifting to figure out which ones.
  • Licensing: Not an issue with the open source projects in this review, but for most of the quality commercial products sporting open, powerful extensibility, this is a huge issue, and probably a deal breaker for us at the end of the day because we want the flexibility to throw our application on any number of servers at any time to suit any purpose without throwing fistfuls of money into the furnace each time we do so. This is probably not so much of an issue for shops wanting to build systems for their own companies, or for consultants or integrators building unique systems one at a time for their customers.
  • Technical Fit: This is sort of a two part problem – is the product under review capable of easily being extended to seamlessly integrate with and host our custom applications, authentication mechanisms and Asynchronous Messaging Lifestyle, and is the system documented well enough that it even matters what it is technically capable of.

Anyway, I’ve spend more hours than I care to admit scouring the web for CMS systems that will accelerate our time to market while using modern techniques and technologies (.NET compatible only) and at the same time offers a licensing model that will allow us to operate freely in our own marketplace. While the hammer hasn’t fallen yet in our decision making process, the licensing of models of the top tier commercial options are probably going to be too restrictive. But I’m listing them here anyway because our licensing needs are unique.

Commercial Products:

Sitecore CMS – very powerful, very polished product. They have a suite of web 2.0 collaboration modules you can buy, a "Foundry" product that allows you to manage large numbers of sites at once, and a nice developer, content designer and end user experience. Their licensing, though, didn’t work for us. They wouldn’t license their intranet / web 2.0 product to us at all because we sell to external customers, and their Foundry product had page limit caps on it. There were no other options, so, unfortunately, not for us.

Ektron CMS – Also a very nice product. The administrative functionality definitely feels a bit old school from a look and feel perspective (especially when compared to the Office 2007 Ribbon interface and "virtual web desktop" features of Sitecore) but the suite of pre-built portal controls can’t be beat. Well thought out, lots of social networking features, easy to integrate, very nice.  The sales experience was head and shoulders above Sitecore. The demo’s were all impressive, they have a blue million fully featured "starter sites" you can download and play with that feature various strengths and uses for the product, and the sales team is highly responsive, and willing to work with our devs to build a prototype during the evaluation process. I like this company a lot – BUT – you need to buy a server license for each URL – and we’ll host dozens of URL’s, many for small low-revenue companies, and so that may not work for us.

Kentico – well priced product, you can set up a sandbox without sales intervention and start playing around, plenty of features for the bullet point-sheet, BUT – it just felt a little awkward and clunky to me. Check it out for yourself, but it wasn’t quite what it needed to be for us to built our product out of it.

Episerver – The website got me all excited – the technology looks GREAT – but good luck buying the thing in the US. They only sell through partners, they only list three US partners on their site, and I couldn’t get a single one of them to call me back. Requests for sales support on their website went unanswered – SO… no thanks. (As if I had a choice).

Sitefinity – from Telerik, a vendor of very nice ASP.NET UI controls (and windows forms controls). Attractive site with workflow built-in, *very* inexpensive, but not in the same league with the other players in terms of functionality or maturity. Probably great for outward facing websites, not enough meat for our portal app.

Two others I didn’t carefully review but that look nice enough:

http://www.adxstudio.com/
http://www.contentxxl.com/Home.aspx

Commercial, but FREE?!

AXCMS – Support driven, like an open source project, but not open source. Odd duck. We haven’t looked at this one yet, just found it yesterday, but it looks promising. I’ll update this post once we’ve dived deeper.

Open Source

There are quite a few mature, open source CMS products for ASP.NET out there. Probably the most famous is DotNetNuke, but there are at least five or six mature competitors and a few nascent but promising projects as well.

DotNetNuke – I don’t have much to say about this project, except that it is hugely popular, but just not for me. The code base is in VB.NET, which isn’t a deal breaker, but not my preference all things being equal. Also the extensibility framework seems to be just a touch messy. My preference is to define controls that are fundamentally independent of a framework and easily wire them in. DotNetNuke likes things a little more intimate last time I checked. But there is a huge selection of pre-built modules to choose from for free, and many for sale, but also many of very low quality, so you have to be careful (although they are almost all very cheap, so the risk isn’t high). I believe DotNetNuke has a service organization, so you can buy professional support, and there are many, many vendors and consultants offering everything from full DNN implementations to skin designs.

Raibow Portal – I didn’t take a very close look at this project, even though it seems reasonably popular and quite deep. Mostly because it too suffers from the million-modules of questionable quality issue, and it isn’t very attractive our up to date feeling out of the box. If I’m evaluating a product and feel like I’m back in 1998, it is hard for me to stay engaged. Probably a personal issue, so don’t let it dissuade you from taking a peek.

Cuyahoga Project – this is a sparse CMS framework meant to be extended, and from what I can see extending it is not hard. It comes with a few basic modules, like a blog and news. The admin UI is clean and relatively un-adorned, and I believe its development takes an ALT.NET bent. We’ll be taking a closer look at this one. Documentation is a bit spar
se and scattered, though, but that is common in the ASP.NET Open Source CMS arena, it seems.

Umbraco – A very nice, relatively mature CMS. It is in beta for a 4.0 version with looks vastly improved, with a renovated plug-in architecture, ASP.NET Provider security, and many other enhanced features. The 4.0 release looks like it will be so much better than the 1.x version, we haven’t dived too deeply into the 1.x version and are seeing if we can hold out. This project also has rather spotty, user contributed-feeling documentation, but has an active and vibrant community to help balance that out. Also backed by a support organization if you want commercial support, and you can license the software cheaply for commercial purposes if you want to brand the administrative user interface. We will be taking a much closer look at this project in the near future as well.

[UPDATE:Here is a link to the Umbraco 4.0 beta page. This page provides an overview of the new features, as well as links to download a developer preview and a screencast on installing the developer preview.]

Portal Engine & Enterprise CMS – this project is open source, but not available yet. They seem to be preparing for an imminent beta release, but no source code as of yet. Of all the products I’ve evaluated so far, commercial or open source, this one has me the most excited by far. I do hope it becomes available in time for us to leverage it (and that it is all that it appears to be).

As of this afternoon (10/1/2008) the Sense/Net Beta 1 of this product is available on CodePlex. The product home page is here.

Here is how they bill themselves:

Sense/Net Portal Engine is an Open Source application suite for building integrated Enterprise Content Management (ECM, ECMS) and Enterprise Portal (EPS) solutions running on the .Net and Mono platform. Sense/Net Portal Engine TNG is an Open Source alternative to Microsoft SharePoint

Sounds great eh? It looks beautiful, appears to be backed by a large team, and also has a support organization. Actually, it is the next generation re-write of an established commercial ECMS product. The open source version is the next iteration, appropriately suffixed with TNG -  "The Next Generation." They cite as a motivation for the project the lack of an enterprise grade CMS in the open source, .NET space, and I have felt that same vacuum myself, so I’m keeping my fingers crossed. The best part, for me, is that they are providing a technology that I believe can be used outside the portal engine called the Portal File System, which is a robust, open source, hierarchical content repository with versioning and security, etc, like the Java cats have had forever but unlike anything that can be found in .NET (that I have been able to find). You can sign up for the beta, but you don’t get an e-mail when you do that confirms your request, so hopefully the sign-up is functional. Their blog is here: http://blog.portalengine.org/

Other open source projects I haven’t looked closely at:

http://n2cms.com/
http://www.devage.com/

And a nascent but active CMS being build on the new ASP.NET MVC framework:

http://www.codeplex.com/MVCMS

We’ll continue to explore, and report back once we’ve managed to build a few prototypes on the various platforms.

.NET Utility Libraries Galore

July 15, 2008

Yesterday Karl Seguin announced a new .NET Extension Library. One of the really interesting pieces of the library is a streamlined approach to a simple dictionary imagecache, which is similar to the one described in another interesting looking utility library called ShadeTree. Recently, Ayende Rahein reviewed another .NET utility library called Umbrella, which looks like a pretty wide and deep set of utilities. As I am about to create a new solution to consolidate the utility functionality we use across our various projects, it got me thinking it might be time to pick an established (or growing) library from the community and try to contribute any missing pieces we need for our own projects.

I figured that the three utility libraries mentioned above probably weren’t the only ones – it’s something anyone that works on more than one project is likely to at least think about creating, and something that is easy to contribute to open source, because utility libraries like these are generic by their nature. Here is what I found on Codeplex (none of these are dead – they all have relatively recent check-ins, and decent download traffic):

http://www.codeplex.com/Utilities
http://www.codeplex.com/publicdomain
http://www.codeplex.com/nice <- primarily graphics and math
http://www.codeplex.com/DotnetCommons
http://www.codeplex.com/dotNetTipsUtility
http://www.codeplex.com/toolbox
http://www.codeplex.com/nucleo

And the two already mentioned:

http://www.codeplex.com/umbrella
http://www.codeplex.com/nxl

And the Shade Tree project:

http://storyteller.tigris.org/source/browse/storyteller/trunk/src/ShadeTree.Core/?rev=177#dirlist

 

[Update/Correction] Apparently Rhino Commons is far more than a collection of utilities. To be honest, I haven’t looked too closely at it yet, and had a misconception about what it was. Time to repair my ignorance, I suppose.
http://ayende.com/wiki/Rhino+Commons.ashx
If you’re interested in learning a bit about Rhino Commons, and you don’t mind learning about it in the context of ASP.NET MVC, or alternatively you just want to visit a site called “frickinsweet.com”, check out this series of posts by Ryan Lanciaux: (I’m linking to part one – there are currently 5 parts)
http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC.aspx

Here’s a “utility” library with some light similarity (but much smaller scope) to Rhino Commons (in that it contains Repository and Unit Of Work implementations for NHibernate), and there is some WCF bag-o-trick stuff here as well:
http://davybrion.com/blog/stuff/

 

And for good measure, here is a round up of the extension method collections I’ve seen lately:

http://weblogs.asp.net/okloeten/archive/2008/06/19/6296904.aspx
http://weblogs.asp.net/okloeten/archive/2008/08/01/6463327.aspx
http://www.iridescence.no/Posts/A-Set-of-Useful-Extension-Methods-for-DateTime.aspx
http://james.newtonking.com/archive/2008/03/27/formatwith-string-format-extension-method.aspx
http://www.hanselman.com/blog/ASmarterOrPureEvilToStringWithExtensionMethods.aspx
http://elegantcode.com/2007/12/05/firing-events-with-extension-methods/

Here is a new library of extension methods for .NET 3.5, and a blog post describing the project

http://codeplex.com/dotNetExt

Update: Vijay Santhanam mentioned a website in the comments, http://www.extensionmethod.net/, that is pretty much exactly what I had in mind when I wrote the below paragraphs. It would be cool if it could be used beyond extension methods, for other sorts of utility classes & tools (maybe it can), but still, very cool website.

 

Wow…That’s a Lot

I’m not likely to have time to evaluate them all in order to choose one, but it got me thinking about utility libraries in general and if it makes sense to “choose one” at all. Utility Libraries (that is, all purpose, non-specialized ones, like the giant Swiss army knife above) are kind of personal. They aren’t like other libraries, where you have something you need done, and they do it well. They are all the million odd places you put a dab of oil onto the framework you’re using because it sticks or creaks, and one thing is certain, no matter how complete your utility library, you’ll need that one more helper class here and extension method there, and at a moments notice, and you’ll need somewhere to put them. Maybe a utility library is less like a giant Swiss army knife and more like a fisherman’s hat or a tackle box, everyone has one, they contain a lot of the same things, but every team has their own, highly personal selection that makes sense to their particular style and scope of work. image

Another problem with finding “the” utilit
y library to use is that, while I’m sure there is heavy overlap among the various options, while perusing each I’m certain to  find a few utilities done very well in one library, and others done very well in another, and yet I don’t want to reference half a dozen utility dll’s in my project.  For instance, the caching mechanism in the new .NET Extension Library looks awfully handy, but the Umbrella project contains a number of great things I think I would use on a daily basis as well. As I look through the others, I’m quite certain I’ll continue to have that experience.

That makes me more likely to cut and paste code out of the various offerings into my own utility library more likely than with any other kind of open source project I can think of, in the same way perhaps as a fisherman prepares his tackle box.

Well, I don’t have a good solution to this, but I wonder if the utility library concept doesn’t really work as an open source project you choose and use as your main utility provider, unless perhaps everyone can agree on one, and the barrier to getting contributions accepted is very low. Another approach might be a Wiki approach (Karl Seguin’s own Code Wiki comes to mind, or a version of it anyway) where anyone can contribute source code and tests for their utilities very easily, and people can comment on or discuss them, download them or cut and paste them. The whole thing could probably be available as a solution, but it would also be easy to pull out pieces via copy and paste or maybe single file download that match your type of projects and your style of working, and it would be A-OK to have lots of utilities even for edge cases and niche’s, because the thing wouldn’t need to be monolithic. And it would be searchable, tag-able, browse-able, etc.

Anyway, that isn’t likely to happen any time soon, even if it’s feasible, which it might not be. In the mean time, I imagine it is cut and paste for me :)

[Update: http://www.extensionmethod.net/ looks like it might be the kind of thing I'm talking about]

Another Free E-Book – Domain Driven Design Quickly

July 10, 2008

Yet another community gift – this time an e-book about Domain Driven Design. You can buy a print version but the PDF is free, and small enough to easily print out yourself and bind with a clip. The book is by the founder and editor of InfoQ.com, and is billed as a summary of Eric Evans (this one, not this one ) famous book, Domain Driven Designimage At this rate I may never have to purchase another book again.

Linxter Offers Durable Messaging for Remote Clients

A discussion on the nServiceBus discussion list has been taking place recently regarding how to have durable messaging on remote nodes, such as smart clients, where the deployment and maintenance requirements of MSMQ aren’t tenable. The main concept being tossed around was a local database to hold un-sent messages at the remote endpoint that could be attached to any transport, making any non-durable transport durable. Ayende went off to build a prototype (but hasn’t reported back, so I’m not sure if it is still in progress, although there were strange noises coming out of his blog recently that suggest he might still be working on it) and it was mentioned that Evan Hoff was building such a thing using Berkeley DB.

One advantage of both of those options is that durability could be bolted on to any transport, such as HTTP or one of the non-durable WCF bindings, without much fuss. However there is at least one commercial service that I’ve talked about before, Linxter, that provides an internet-oriented message transport (or Internet Service Bus, ISB) with lots of cool features. What I didn’t realize, until today, was that the Linxter client API does exactly what was discussed at the NSB forum – provides a local cache for messages via an embedded DB (SQLite in this case), essentially enabling an x-copy deployable, durable, asynchronous messaging endpoint.

Of course, it doesn’t have the flexibility to attach “durability” to any conceivable transport – because Linxter is it’s own transport – but in most cases I don’t think that should be a big issue. The only question now, is, how much will it cost? Apparently pricing will be announced with Beta 3, which is scheduled for July 31st. Version 1.0 is scheduled for August 15th.

Here is the e-mail I received from Lixter’s Jason Milgram explaining the local queue:

Yes, the Linxter API queues messages locally (does this in Beta2), and does not take them off the queue until they are delivered. In Beta 3, we will offer additional reliability and efficiency for file transfers by enabling chunking. For example, let’s say you are transferring a 100MB file, and after transmitting 70MBs you lose your connection,…when the connection is re-established, it picks up from where it left off. We felt that these queuing and chunking features were pretty important especially with wireless connectivity becoming the norm.
The ISB is a distributed system, with failover built into the SDK (API)  as well as on the ISB. If the API cannot connect to a service on a particular set of clustered servers, it will failover to another set of servers. We can also dynamically reprovision server and service assignments for programs.

And here is the updated roadmap [emphasis mine]:

Release dates:

  • July 31st        Beta 3
  • Aug. 15th        Version 1.0

Beta 3 Overview:

  • Linxter SDK for both .NET and Java
  • Reorganization of methods for on demand and scheduled sending
  • Enhancements to Web Manager user interface
  • Web Manager support for both IE and Firefox
  • Standardization of API local datastore to SQLite
  • Availability of Quick Starts – feature based sample apps

On our website we have added the following: