Created
June 6, 2016 17:44
-
-
Save ideaflare/db8898706e6aa227918c2751403fe5fb to your computer and use it in GitHub Desktop.
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
| // 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"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment