Skip to content

Instantly share code, notes, and snippets.

@rofr
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rofr/9682677 to your computer and use it in GitHub Desktop.
Save rofr/9682677 to your computer and use it in GitHub Desktop.
First origodb scriptcs script
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