Last active
August 29, 2015 13:57
-
-
Save rofr/9682677 to your computer and use it in GitHub Desktop.
First origodb scriptcs script
This file contains 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
using OrigoDB.Core; | |
[Serializable] | |
public class MyModel : Model | |
{ | |
Dictionary<string,object> _store = | |
new Dictionary<string,object>(); | |
public void Put(string key, object value) | |
{ | |
_store[key] = value; | |
} | |
public void Delete(string key) | |
{ | |
_store.Remove(key); | |
} | |
public object Get(string key) | |
{ | |
object result; | |
_store.TryGetValue(key, out result); | |
return result; | |
} | |
public string[] Keys(int skip = 0, int take = 10) | |
{ | |
return _store.Keys.OrderBy(k => k) | |
.Skip(skip).Take(take).ToArray(); | |
} | |
} | |
var db = Db.For<MyModel>(); | |
db.Put("hello", "world"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment