Created
September 17, 2014 03:16
-
-
Save rofr/d54e7b89947ff9ffc5dd to your computer and use it in GitHub Desktop.
OrigoDB Document database engine wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class DocumentDatabaseEngine | |
| { | |
| private readonly Engine<DocumentModel> _engine; | |
| public DocumentDatabaseEngine(string location) | |
| { | |
| _engine = Engine.LoadOrCreate<DocumentModel>(location); | |
| } | |
| public DocumentDatabaseEngine() : this(String.Empty) | |
| { } | |
| public object Get(object key) | |
| { | |
| return _engine.Execute(db => db.Get(key)); | |
| } | |
| public T Get<T>(object key) | |
| { | |
| return _engine.Execute(db => db.Get<T>(key)); | |
| } | |
| public T Get<T>(Func<Dictionary<object,object>,T> query ) | |
| { | |
| return _engine.Execute(db => db.ExecuteQuery(query)); | |
| } | |
| public void Put(object key, object document) | |
| { | |
| var command = new PutCommand(key, document); | |
| _engine.Execute(command); | |
| } | |
| public bool Remove(object key) | |
| { | |
| var command = new RemoveCommand(key); | |
| return _engine.Execute(command); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment