-
Notifications
You must be signed in to change notification settings - Fork 2
Quick Start
rexm edited this page Sep 28, 2014
·
8 revisions
nuget install SimpleDb.NET
If you don't already have an Amazon Web Services account, sign up for free.
Get your public and private API keys - you need both to make API calls. Be sure to keep them safe!
SimpleDb.NET doesn't require any configuration. To begin using it, just call SimpleDbContext.Create
:
using(var simpleDb = SimpleDbContext.Create("publicKey", "privateKey"))
{
// Create a Domain
var myFirstDomain = simpleDb.Domains.Add("MyFirstDomain");
// Add some items to our domain
myFirstDomain.Items.Add("MyFirstItem", new Dictionary<string, SimpleDbAttributeValue> {
{ "ProductName", "Cheese" },
{ "Price", 3.45 }
});
myFirstDomain.Items.Add("MySecondItem", new Dictionary<string, SimpleDbAttributeValue> {
{ "ProductName", "Crackers" },
{ "Price", 1.99 }
});
// Call Submit so our new items actually get sent and saved to AWS
simpleDb.SubmitChanges();
// Query our domain for items with a price higher than 2
var expensiveItems = from item in simpleDb.Domains["MyFirstDomain"].Items
where item["Price"] > 2
orderby item => item["Price"] descending
select item;
// Delete everything to clean up
myFirstDomain.Delete();
}
Check out the Technical Docs to get a complete API reference.