Unable to render {include} The included page could not be found.

Introduction (NHibernate)

Current version of DelftShell - Q1, 2008 uses XML file format as a project store. It works ok for a simple applications where number of objects contained in the project is not so big or where size of those objects is not so big. When size of the objects becomes bigger - use of XML files as a data store format does not sound as a scalable and robust solution. Those objects can be for example: models, maps, grids, time series, model results, etc. Current intention is to switch to an embedded database file format to be used as a project store. It can be one of SQLite, Access or any other embedded database file format.
Another reason is that using XML serialization it seems to be very complicated to serialize objects implementing interfaces such as IModel, IDataItem. For that reason they were implemented as abstract classes.

In .NET access to the database is implemented using ADO.NET, however in this case syntax of the SQL queries used to access data dependents a lot from the concrete database driver implementation which. Another problem is that all data should be handled manually (convert from relational model to objects and vice-versa). There are number of libraries available which can help to access data from a database:

  • NHibernate and probably NHibernate.Linq in the future - provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database.

Advantages from use of the ORM libraries over simple ADO.NET implementation are clear and should not be underestimated:

  • encapsulation of all data access logic used to map data between tables <-> objects from the rest of the system
  • independence from a concrete database implementation
  • robust transaction management
  • database-independent SQL language

More information about NHibernate can be found here:

In a short functionality provided by NHibernate can be shown on the following drawing:

NHibernate required mapping to be defined in order to map an entity represented by some object (or a set of objects) to a table (or set of tables) in the relational database. This mapping is used to read data from a database and instantiate corresponding object in a memory. Such an object called POCO (Plain Old CLR Object). The same mapping is used to write object or only changed properties of object back into database.

In NHibernate object can exist one of the following states:

Note: drawing is taken from a Java version of Hibernate and contains method names in Java notation.

Project States in DelftShell

  • No labels