Release: AWS SDK for .NET 1.5.1

Release Notes>Release: AWS SDK for .NET 1.5.1
This release adds support for Binary types to Amazon DynamoDB.

Details

Submitted By: Pavel@AWS
Created On: August 21, 2012 10:12 PM GMT
Last Updated: August 24, 2012 12:38 AM GMT

Download

Download the latest AWS SDK for .NET

New Features

Change Description
Amazon DynamoDB

In this release, .NET SDK is adding support for Amazon DynamoDB Binary types. This will allow you to store arbitrary binary data in a Amazon DynamoDB item.

The sample below shows how to store binary data into Amazon DynamoDB using the base API.

				   
Dictionary<string, AttributeValue> item = new Dictionary<string,AttributeValue>();
item["Id"] = new AttributeValue { N = "3" };
item["Email"] = new AttributeValue { S = "example@sample.com" };
item["Binary"] = new AttributeValue { B = new MemoryStream(new byte[] { 42, 91, 12 }) };
item["BinarySet"] = new AttributeValue {
	BS = new List<MemoryStream> {
		new MemoryStream(Encoding.UTF8.GetBytes("Once upon a midnight dreary,")),
		new MemoryStream(Encoding.UTF8.GetBytes("while I pondered weak and weary")), } };
PutItemRequest request = new PutItemRequest {
	TableName = "SampleTable",
	Item = item };
client.PutItem(request);
				   

Binary support has also been added to the higher-level Amazon DynamoDB namespaces, Amazon.DynamoDB.DocumentModel and Amazon.DynamoDB.DataModel. The next sample shows how to store binary data into Amazon DynamoDB using the Table and Document objects.

var table = Table.LoadTable(client, "SampleBinaryTable");

Document document = new Document();
document["Id"] = Encoding.UTF8.GetBytes("Tom Sawyer");
document["Sequence"] = Encoding.UTF8.GetBytes("1");
document["Data"] = new List<MemoryStream> {
	new MemoryStream(Encoding.UTF8.GetBytes("Mississippi River")),
	new MemoryStream(Encoding.UTF8.GetBytes("St. Petersburg")) };
table.PutItem(document);
				   

These last two examples show how byte[]/MemoryStream types can be used in a persisted class without the need for converters.

[DynamoDBTable("SampleBinaryTable")]
public class BinaryPerson
{
	[DynamoDBHashKey]
	public byte[] Id { get; set; }

	[DynamoDBRangeKey]
	public MemoryStream Sequence { get; set; }

	public List<MemoryStream> Data { get; set; }
}
				   
DynamoDBContext context = new DynamoDBContext(client);
BinaryPerson person = new BinaryPerson
{
	Id = Encoding.UTF8.GetBytes("Huckleberry Finn"),
	Sequence = new MemoryStream(new byte[] { 50 } ),
	Data = new List<MemoryStream> {
		new MemoryStream(Encoding.UTF8.GetBytes("Mississippi River")),
		new MemoryStream(Encoding.UTF8.GetBytes("St. Petersburg")) }
};
context.Save(person);
				   

Note: this addition necessitates a number of breaking changes. They are as follows:

  • Changes to type Amazon.DynamoDB.DocumentModel.Primitive
    • New constructors are added that can accept MemoryStream or byte[] as values
    • Value property has been changed from type string to type object
    • SaveAsNumeric property has been replaced with Type property
    • Added methods to convert Primitive to/from MemoryStream and byte[]
  • Changes to type Amazon.DynamoDB.DocumentModel.PrimitiveList
    • Removed constructor that takes bool saveAsNumeric and replaced with constructor that takes DynamoDBEntryType type
    • SaveAsNumeric property has been replaced with Type property
    • Added methods to convert PrimitiveList to/from List<MemoryStream> and List<byte[]>
  • Changes to type Amazon.DynamoDB.DocumentModel.Table
    • Added properties HashKeyType and RangeKeyType, which identify the key schema for the table
    • Properties HashKeyIsNumeric and RangeKeyIsNumeric have been marked as obsolete

Known Issues

Issue Description
Installation Requires Administrator Privileges The default install location is %PROGRAMFILES%, which on most computers is "c:\program files". In order to install files to the default location, the MSI must be run by an Administrator. If you don't have Administrator privileges on the machine, please change the install location to something like "c:\Documents and Settings\<you>\AWS SDK for .NET", and the install will complete successfully. If you are running on Vista, your personal folder is similar to "c:\users\\".
Uninstalling the SDK Produces "Unknown Publisher" Message On Windows Vista, uninstalling the MSI results in an "Unknown Publisher" dialog even though the installer is signed by Amazon Web Services. This is a known Windows Installer bug on Windows Vista, and is documented here: http://support.microsoft.com/kb/929467/en-us

Supported API Versions

This release of the SDK supports the following API versions:

Service API Version
Amazon CloudFront 2012-05-05
Amazon CloudSearch 2011-02-01
Amazon CloudWatch 2010-08-01
Amazon DynamoDB 2011-12-05
Amazon Elastic Compute Cloud 2012-07-20
Amazon Elastic MapReduce 2009-03-31
Amazon ElastiCache 2012-03-09
Amazon Glacier 2012-06-01
Amazon Relational Database Service 2012-07-01
Amazon Simple Email Service 2010-12-01
Amazon Simple Notification Service 2010-03-31
Amazon Simple Queue Service 2011-10-01
Amazon Simple Storage Service 2006-03-01
Amazon Simple Workflow Service 2012-01-25
Amazon SimpleDB 2009-04-15
Auto Scaling 2011-01-01
AWS CloudFormation 2010-05-15
AWS Elastic Beanstalk 2010-12-01
AWS Identity and Access Management 2010-05-08
AWS Import/Export 2010-06-01
AWS Route 53 2012-02-29
AWS Security Token Service 2011-06-15
AWS Storage Gateway 2012-03-12
Elastic Load Balancing 2012-06-01
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.