Created
June 20, 2013 11:21
-
-
Save ochilab/5821961 to your computer and use it in GitHub Desktop.
C#でDynamoDBにMapperを利用してデータを保存するサンプル
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 Amazon.DynamoDB; | |
using Amazon.DynamoDB.Model; | |
using Amazon.DynamoDB.DataModel; | |
public static void Main(string[] args) { | |
Console.WriteLine("Setting up DynamoDB client"); | |
client = new AmazonDynamoDBClient(RegionEndpoint.USEast1); | |
DynamoDBContext context = new DynamoDBContext(client); | |
SampleData sample = new SampleData(); | |
sample.id = "0000"; | |
sample.name = "ochilab"; | |
sample.value = "日本語"; | |
context.Save(sample); | |
} |
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 Amazon.DynamoDB.DataModel; | |
[DynamoDBTable("DynaTest")] | |
class SampleData { | |
[DynamoDBHashKey(AttributeName = "id")] | |
public string id { get; set; } | |
[DynamoDBRangeKey(AttributeName = "name")] | |
public String name { get; set; } | |
[DynamoDBProperty("value")] | |
public String value { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment