This project is read-only.

NDatabase Indexes

Indexes are implemented using B-Tree structure.
  • The namespace NDatabase.BTree contains a generic B-Tree implementation.
  • Index definitions are stored in NDatabase as normal objects of class NDatabase.Odb.Core.Layers.Layer2.Meta.ClassInfoIndex (this class is marked as a system class).
  • Index content is stored in NDatabase as NDatabase.BTree.IBTree and NDatabase.BTree.IBTreeNode.

How to use indexes

To use index, firstly you need to invoke method GetClassRepresentation<T>() on IOdb instance. This class representation will allow you on Index manipulation (Add, Delete, Rebuild).

Sample code:
using (var odb = OdbFactory.Open("index1.ndb"))
    var fields = new[] { "Name" };
    odb.IndexManagerFor<Player>().AddUniqueIndexOn("nameIndex", fields);
    odb.IndexManagerFor<Game>().AddIndexOn("nameIndex", new[] { "Result" });

    // more code ...

Configuration of tree degree

The default degree of the B-Tree can be configured using the NDatabase.Odb.OdbConfiguration.SetDefaultIndexBTreeDegree(int degree) method. The default degree is 20.

Last edited Dec 28, 2012 at 1:13 PM by jacek, version 10


No comments yet.