开发者

Strongly typed access to Amazon S3 using C#

I'm currently migrating a Windows Azure application to Amazon AWS. In Windows Azure we used Lokad.Clout to get strongly typed access to Azure Blob Storage. For instance like this:

foreach(var name in storage.List(CustomerBlobName.Prefix(country))
{
  var customer = storage.GetBlob(name); // strong type, no cast!
  // do something with 'customer', snipped
}

For more detailed examples see their wiki.

In the AWS SDK for .NET you don't get strongly typed access. For ins开发者_运维问答tance in order to achive the above you have to execute ListBojects and then parse the key of every object in order to find the each individual property of the key (we often use keys consisting of several properties).

Is there any S3-equivalent to Lokad.Cloud for Azure?

UPDATE: Due to the size of the objects we cannot use SimpleDB (with Simple Savant).


Instead of using S3 for this, I think you want to use Amazon SimpleDB. It allows you to store data in key-value pair format, and also run queries on the data.

Then, to do what you're looking for, I think what you want is Simple Savant.

Simple Savant is a .NET object-persistence framework for Amazon SimpleDB written in C#.

With Simple Savant, you can save objects like this:

var savant = new SimpleSavant(AwsAccessKeyId, AwsSecretAccessKey);
var customer = new Customer
    {Name = "Frank Berry", PhoneNumbers = new List<string> {"770-555-1234", "678-555-5678"} };
savant.Put(customer);

And you can retrieving objects like this:

 var frankId = new Guid("50a60862-09a2-450a-8b7d-5d585662990b");
 Person frank = savant.Get<Person>(frankId);  // strong type, no cast!

Hope this helps!


This is not something that S3 was optimised for.

You should use S3 to store your blobs and a database (SimpleDB, Sql Server etc) to 'index' your S3 storage. Use the database to find what you are looking for, get the object from S3, make changes, then save it back.


I solved it myself by porting those particular name-classes in Lokad.Cloud from Azure to S3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜