Unofficial EJDB C# .Net binding
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 103 commits ahead, 4 commits behind Softmotions:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
Nejdb
Tests
lib
quarks
.gitignore
LICENSE
README.md
SolutionVersion.cs
TotalCleanUp.ps1
build.ps1
nejdb.iml
nejdb.sln
nejdb.sln.DotSettings
nejdb.userprefs

README.md

Unofficial .Net Binding for EJDB

Note: This is early days, API is subject to change.

You can install it using nuget:

  • install-package Nejdb.Unofficial

What's differences with official binding

  1. tcejdbdll.dll is embedded in resource, and loaded at runtime for both x32/x64.
  2. API is closer to .Net style, not C style.
  3. Better unmanaged resource handling.
  4. Dropped support for Mono (I hope it's not hard to restore it).
  5. Nuget package available.

One snippet intro. Look at documentation for details.

using System;
using System.IO;
using Nejdb;
using Nejdb.Bson;
using Nejdb.Internals;

namespace sample 
{
	class MainClass 
	{
			using (var library = Library.Create())
			using (var database = library.CreateDatabase())
			{
				database.Open("MyDB.db");
				using (var collection = database.CreateCollection("Parrots", CollectionOptions.None))
				{
					var parrot = BsonDocument.ValueOf(new
					{
						name = "Grenny",
						type = "African Grey",
						male = true,
						age = 1,
						birthdate = DateTime.Now,
						likes = new[] { "green color", "night", "toys" },
						extra = BsonNull.VALUE
					});
					collection.Save(parrot, false);
				}
			}
		}
	}
}