Why NDatabase
NDatabase is a simple .Net Object Database. To avoid impedance mismatch overhead between Object and Relational worlds, give a try to NDatabase. NDatabase is a new generation Object Database: a real native and transparent persistence layer for .Net.
Safe and Robust
NDatabase supports ACID transactions to guarantee data integrity of the database. All committed work will be applied to the database even in case of hardware failure. This is done by automatic transaction recovery on the next startup.
Productivity
NDatabase lets you persist data with a very few lines of code. There is no need to modify the classes that must be persisted and no mapping is needed. So developers can concentrate on business logic implementation instead of wasting time with the persistence layer..
The Basics
// Create the instance be stored var sport = new Sport("volley-ball"); // Open the database using (var odb = OdbFactory.Open(DbName)) { // Store the object odb.Store(sport); }
// Open the database using (var odb = OdbFactory.Open(DbName)) { var sports = odb.QueryAndExecute<Sport>(); Assert.That(sports, Has.Count.EqualTo(1)); }
// Open the database using (var odb = OdbFactory.Open(DbName)) { var firstSport = odb.QueryAndExecute<Sport>().GetFirst(); firstSport.Name = "new name"; odb.Store(firstSport); }
//Open the database using (var odb = OdbFactory.Open(DbName)) { var first = odb.QueryAndExecute<Sport>().GetFirst(); odb.Delete(first); } // Open the database using (var odb = OdbFactory.Open(DbName)) { var sports = odb.QueryAndExecute<Sport>(); Assert.That(sports, Has.Count.EqualTo(0)); }
public sealed class Sport { private string _name; public Sport(string name) { _name = name; } public string Name { get { return _name; } set { _name = value; } } public override string ToString() { return Name; } }