While writing the code necessary for this installment, I found myself
falling prey to feature-creep. So I've decided to keep it fairly simple in the
beginning. However, once the basic components are working I'll start
introducing more features. I thought this might be a good way to demonstrate
what is and isn't required to add new functionality to a working NHibernate
application.
The application's initial functionality will consist of blog users being
able to post new blog posts, comment on posts, and reply to other comments.
Only users with the correct role membership will be able to post, all users will
be able to comment and reply to comments. Also, the comments should be threaded
so conversations can be followed more easily.
The domain model has just 4 classes (for now):

The Sql Express 2005 database will have 5 tables persisting our 4
classes. The extra database table UserRole will persist the many-to-many
relationship between BlogUser and BlogRole.

Also notice that the "Depth" property in the Comment class is not
actually persisted, it is a read-only value that is generated when a collection
of comments for a BlogPost is loaded and represents the level of the comment in
the comment hierarchy (threaded convesations!). See the attachment for the database script.
In Part III we will create the mapping glue that binds the model and
database together.
Posted
05-22-2007 8:26 PM
by
anortham