Skip to content

ideaflare/embark

Repository files navigation

Idea

Easy to use document database with a focus on visibility and simplicity. Made for prototyping or projects with an agile code-first approach. Embark allows you to defer the plumbing or commitment of choosing a specific database technology.

Visibility

Documents are saved as JSON text files in folders for each collection, so you can easily view/edit data while developing.

Documents saved as text files

Simplicity

Embark uses public properties with get & set to read/load values.

// arrange some guinea pig for testing
class Sheep
{
  // public get & set used to read/write values
  public string Name { get; set; }  
  public IceCream FavouriteIceCream { get; set; }
}
enum IceCream
{
  Vanilla,
  Strawberry            
}
        
var pet = new Sheep { Name = "Fluffy", FavouriteIceCream = IceCream.Vanilla };

// save data locally
var db = Embark.Client.GetLocalDB(@"C:\AnimalsDB\");

// or over a network via REST API to WCF server *see usage section below*
var db = Embark.Client.GetNetworkDB("192.168.1.24", 8080);

// collections created on-the-fly if needed
var io = db.GetCollection<Sheep>("sheep");

// create
long id = io.Insert(pet);

// read
Sheep fluffy = io.Get(id);

// update
fluffy.FavouriteIceCream = IceCream.Strawberry;
bool fluffyNowLikesStrawberry = io.Update(id, fluffy);

// delete
bool hasSheepVanished = io.Delete(id);

// non-type specific if you want to mix Apples & Oranges objects in the same collection
var io = db["fruit"];

Some other commands are

  • GetWhere(new { Name = "Rocket"})
  • GetBetween(new { Score = 15}, new { Score = 39.21})
  • GetAll() returns Document Wrapper with ID & timestamp
  • See the wiki for details

That's it!

The intent of Embark is to stay simple to use and minimal. A single .dll under 50 kilobytes and no external dependencies other than the .NET framework. By avoiding increasing complexity from scope-creep, Embark will remain crisp and friendly :)

The aim of the project is to provide a DB while you are building new ideas and not to weigh features that do not contribute to prototyping like database replication, query optimizations, optimal disk usage, etc..

alt text

Usage

Embark has a NuGet package to keep devs updated with new features. You are also free to download, modify, compile and use the source code as you wish (MIT License).

Custom text-to-object mapping, like YAML or even DSON is avaliable via the ITextConverter interface passed to a local Client constructor.

To save data over a network:

// start a new server
var server = new Embark.Server();
server.Start();

or you can download a simple server from here.

NOTE: For the WCF server to work, either run it in admin mode or give access rights to the your-machine:port/embark/ namespace.

  • Optional caching & async data persistency
  • Review & Simplify code

Any feedback, suggestions or PR's welcome!

About

Micro NoSQL document database with a focus on visibility & simplicity.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages