Home > .NET Object Database

Signumsoft .NET Object Database

Signumsoft .NET Object Database is a data storage solution to store object oriented data on a Microsoft SQL Server. O/R Mapping happens already on the database. The component builds a solid bridge between the object oriented world and the power of relational databases. (See also: Source Code Example)

How it works

No object relational mapping logic is needed. O/R Mapping happens with pre-generated SQL Views already on the database. Generated database SQL views are always identical to classes in program code! With .NET reflection the object structure and class hierarchy is scanned. The class hierarchy of an application is mirrored on the relational database. Therefore the relational database "knows" whether a class inherits from an other class or not. An SQL view is generated for every class. Every record in such a view represents on object instance. This enables an instant object oriented view to the database.

Database structure

Data is stored in a generic way. Therefore the structure of the database needs never to be changed even if the object hierarchy changes and, or new fields (properties) are added to a class. No object relational mapping (ORM, O/R, OR-Mapper) is necessary! This reduces database administration to a minimum and guarantees compatibility and synchronization between the object model and the relational model. If you want to know how exactly the generic data store works: take a look behind the scene and check out the Signumsoft .NET Object Database Schema.

Benefits

Signumsoft Object Database can easily be used together with .NET DataGridView components, ASP.NET Tables and reporting tools. An object oriented storage solution is guaranteed. It can also be used in connection with LINQ to SQL. (See also: Visual Studio 2008 and LINQ to SQL)

Note: The generated SQL Views enable an object oriented view to the data. Therefore, data can be modified via SQL statements on the views or data can be modified on deserialized objects in memory or data can be modified with DataSets. The three ways are identical and none compromises the object oriented approach!

Hello World Application

The Signumsoft Object Database API is provided with a simple hello world application. It's called MyHospital and contains three simple classes: Person, Patient and Doctor. The class Person contains two fields FirstName and LastName. The class Patient inherits from Person. Since a Patient is sick, it has a field Sickness. And the class Doctor inherits from Person as well. And since a doctor gets money, it has a field Salary. He also takes care of patients. So he gets a list of patients to take care of.

ClassDiagram for Hello World Application - MyHospital:

ClassDiagram 

After you start the application it scannes all classes which inherit from ObjectX. Based on this information the CacheClassTree is built and the following SQL Views are generated:

Generated Database SQL Views are always identical to program code classes:

Generated Database SQL Views are identical to program code classes!


Download Download: Signumsoft .NET Object Database (Version b2.1, Free Trial Version). It includes this Hello World Application AND the database. Download this file and you have all you need: API, Database and Hello World.

Download Download: Hello World ObjectDatabase (Hello World - MyHospital database ONLY with above shown demo data. Download this file if you just want to have a look on the database and the SQL views. Contains no program.)


Hello World Application screen shot:

Screen shot preview

The included Hello World Application shows how to modify and persist data programmatically. It also shows how to modify data the SQL way without compromising the object oriented approach. This is possible because the generated SQL Views are identically with the classes in the code! And it shows how DataGridView can display object oriented data directly from the database!

Note: If you open View_Person you will see all Persons plus all Patients again. This is true because the class Patient inherits from Person.

ObjectX

ObjectX is the base class of all persistent classes. In order to provide your own class just inherit from ObjectX. Important: The inherited class has to implement at least one private (or public) constructor with a signature like this:

public ObjectX(Database database, Guid objectId)
{
    ...
}

This is the constructor called by Signumsoft Object Database when object gets deserialized. This allows a transparent persistence mechanism.

Parameter Description
Database Database to which ObjectX belongs.
ObjectId Every object is uniquly identified by the ObjectId. This is used for serialization and deserialization.

Lists, Dictionaries and Arrays

Signumsoft Object Database API is 100% managed code and fully supports generics. Lists, Arrays and Dictionaries can be serialized and can be used in the data model.

Transactions

The Signumsoft Object Database API is based on the ADO.NET framework. The class Database provides a property SqlConnection. This can be used to call BeginTransaction, Commit or Rollback for complex business transactions.

Roadmap

Following is a list of functions and features which are planed for future versions:

  • Pre-loading and caching. Currently all properties are lazy loading.
  • Function to generate SQL Views to combines multiple class views into one view.
  • Code generation for data layer. This will guarantee strongly typed field names in get and set methods.
  • Stored procedures for better performance. (Currently Sql statements are sent to server)
  • Hierarchical versioning on field level.
  • Application and domain separation. With this it will be possible to store multiple applications with different class hierarchies on same database.

Releases and Downloads

Current and most stable release is Signumsoft.ObjectDatabase b2.1 (Beta 2.1).

Download Download: Signumsoft .NET Object Database (Version b2.1, Free Trial Version)

Requirements: Microsoft SQL Server 2005; .NET Framework 2.0; Visual Studio 2005 or Visual Studio 2008.

Visual Studio 2008 and LINQ to SQL:

Signumsoft .NET Object Database works fine with VS 2008. The following inheritance technique is NOT needed in connection with Signumsoft .NET Object Database: "LINQ to SQL supports single-table mapping, whereby an entire inheritance hierarchy is stored in a single database table. The table contains the flattened union of all possible data columns for the whole hierarchy." (Source: MSDN). The main difference between LINQ to SQL and Signumsoft .NET Object Database is this: .NET Object Database considers program code classes as the "absolute" master and the mapping happens already on the database. Inheritance has not to be defined by 'hand'.

Feedback

For feedbacks to Signumsoft .NET Object Database API and or this article please go to: Contact. Or send an email to: info@signumsoft.com.