DDD

Domain driven design
From a data centric to a domain driven design

Introduction Is NHibernate as an ORM tool or framework better suited for a data centric application or for an application developed by applying domain driven design? Well, that should NOT be the question here. NHibernate can serve equally well both approaches. But which one would you choose? A data centric design The modeling of the data structure is the center piece of this kind of design. The database is the most important part of our architecture. The DBA plays a very important role. Data Layer That's ok for simple problems like managing a collection of...

posted @ Tuesday, February 03, 2009 4:08 AM | Feedback (961)

The Repository Pattern

Introduction When accessing data from a data source we have several well documented possibilities. Martin Fowler e.g. describes several of them in his PoEAA book. Table data gateway Row data gateway Active record Data mapper When applying DDD (domain driven design) we often use the so called Repository Pattern to access the data needed by the domain model. What is a Repository Martin Fowler writes: "A Repository mediates between the domain and data mapping layers,...

posted @ Wednesday, October 08, 2008 1:42 AM | Feedback (1446)

A fluent interface to NHibernate - Part 3 - Mapping Relations

This is the third post in a series of articles where I want to analyze and describe the new upcoming mapping interface providing a fluent interface to NHibernate for the mapping of a domain model to the underlying database. The other posts are A fluent interface to NHibernate A fluent interface to NHibernate - Part 2 - Value Objects A fluent interface to NHibernate - Part 4 - Configuration You can get the source code of the solution accompanying this post here. In the time...

posted @ Friday, August 15, 2008 1:36 AM | Feedback (404)

A fluent interface to NHibernate

Do you like NHibernate? Do you like XML? My answer would be yes for the former and no for the latter. But if you want to map your entities to the underlying database tables you have no other choice than use XML. Ok, you are right, we still have the possibility to use attributes for the mapping (e.g. by using Castle Active Record) but in this case we are "polluting" our nice domain objects with infrastructure related information which definitely does NOT belong into the domain model. Here comes our salvation. We now have a third player in the...

posted @ Monday, August 11, 2008 10:26 AM | Feedback (681)

How to map a tree in NHibernate

Introduction Lately there have been many questions regarding how to best map a tree structure in NHibernate. In this post I'll try to show you various techniques how one can deal with a tree structure. The code for this sample you can get from here. Domain Model Let's define a very simple domain model for this sample. We have a single class called Equipment that has a parent of type Equipment and 0 to many children of type Equipment. The tree has a single root node. The root node is specific by the fact that it's...

posted @ Wednesday, May 14, 2008 10:19 AM | Feedback (438)

Create and Update Database Schema

Introduction When developing an application using DDD one starts by trying to define a model of the domain for/in which the application should be used. At the same time you try to establish the so called ubiquitous language. At some point you might need to store and or retrieve data into or from a data source. Very often this data source is a relational database. But it's not necessarily always the case. It could as well be a web service or a XML document. That leads me to the notion that "the database is just an implementation detail of...

posted @ Monday, April 28, 2008 9:52 AM | Feedback (734)