Overview of Type-DB

Type-DB is made to meet the needs of any developer whether for an embedded project, to implement a cache system, or simply when you need a cool database, it is certain that you will love his modularit

Key-Object Concept instead of Key-Value

The Core Concept of Type-DB is to replace the old concept of KeyValue dictionnaries with a new KeyObject system, that allows you to store any .Net Objects directly into a Type-DB Instance (see Standalone or Remote Mode)

Basic Usage

If you need a simple C# snippet to understand what is Type-DB, take a look here:

basic-example.cs
using (var tdb = new TypeDB.Core(Mode.Standalone).Connect())
using (var db = tdb.OpenDatabase("test", true))
{
db.Set<int>("NumberOfCars", 28);
var numberOfCars = db.Get<int>("NumberOfCars");
Console.WriteLine(numberOfCars);
}

Standalone or Remote Mode

Two operating modes are available on Type-DB, the Standalone mode that does not require the use of a server, which is very convenient for embedded projects, and the Remote mode that is coupled with a Type-DB Server.

Using Example in a Remote Mode:

remote-mode-example.cs
var tdb = new TypeDB.Core(TypeDB.Mode.Remote)
.Configure(new TypeDB.Configuration
{
Endpoint = new Endpoint("localhost", 7000)
})
.Connect();

Complete Example

complete-example.cs
using (var tdb = new TypeDB.Core(Mode.Standalone)
.Configure(new Configuration
{
})
.UsePersistence(new Persistence
{
Type = PersistenceType.OnlyInvoke,
Location = TypeDB.Persistence.TemporaryLocation,
// ChunkSize = 10,
Interval = TimeSpan.FromMinutes(1)
})
// .UseReplication()
// .UseTriggers()
// .UseAuthentication()
// .UseEncryption()
// .UseQuotas()
.Connect())
using (var testdb = tdb.OpenDatabase("test", true))
{
testdb.Set<int>("clint", 29);
testdb.Set<int>("quentin", 22);
testdb.Set<int>("bob", 48);
testdb.Set("players", "elena", "anything you want");
testdb.Expire("bob", TimeSpan.FromMinutes(10));
testdb.Increment("clint", 1);
testdb.Lock("bob");
// testdb.Unlock("bob");
testdb.Drop("bob");
var newAge = testdb.Get<int>("clint");
Console.WriteLine(newAge);
testdb.PrintAll();
// var backup = testdb.Save();
// Console.WriteLine(backup);
}