Extensions for Azure Storage Client library
PM> Install-Package AzureStorageExtensions
Create Context is easy, just inherit from BaseCloudContext and declear property any types of CloudQueue, CloudBlobContainer, CloudTable, and new generic CloudTable<T>
publicclassMyContext:BaseCloudContext{publicMyContext(stringconnectionString):base(connectionString){}publicCloudQueueMyQueue{get;set;}publicCloudBlobContainerMyBlob{get;set;}publicCloudTable<MyClass>MyTable{get;set;}}The new generic CloudTable allow you to create, retrieve, update, replace, merge, delete, query, and bulk opertations much easier.
varperson=awaitcontext.Person.RetrieveAsync(partitionKey,rowKey);awaitcontext.Persons.InsertAsync(newPerson);awaitcontext.Persons.InsertOrReplaceAsync(newPerson);awaitcontext.Persons.InsertOrMergeAsync(partialPerson);awaitcontext.Persons.UpdateAsync(person);awaitcontext.Persons.ReplaceAsync(person);awaitcontext.Persons.MergeAsync(partialPerson);awaitcontext.Persons.DeleteAsync(person);//bulk also support for all operationsawaitcontext.Persons.BulkInsertAsync(persons);//async query also support (required System.Linq.Async)varchildren=await(frompincontext.Persons.Query()wherep.Age<=18selectp).AsAsyncTableQuery().ToListAsync();Table (also blob container and queue) can be parition by time. This is suitable for log or temporary data. Just add setting attribute to property in context.
publicclassMyContext:BaseCloudContext{[Setting(Period=Period.Month)]publicCloudTable<Log>Logs{get;set;}}When new logs insert to table it will be kept based on time.Log201410Log201411Log201412
Azure table limits each property to 64k, but ExpandableTableEntity allows you to keep data up to 1M limit.
publicclassLog:ExpandableTableEntity{publicstringMessage{get;set;}//this message can be up to 1M}AzureStorageExtensions is no more depending on Web.Config. You can add constructor and read connection string.
publicclassMyContext:BaseCloudContext{publicMyContext():base(ConfigurationManager.ConnectionStrings[nameof(MyContext)].ConnectionString){}}