Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Useful extension methods for Windows Azure storage operations that aren't covered by the .NET client library
C#
branch: master

README.md

WazStorageExtensions

smarx.WazStorageExtensions is a collection of useful extension methods for Windows Azure storage operations that aren't covered by the .NET client library.

It can be install using the NuGet package via install-package smarx.WazStorageExtensions and contains extension methods and classes for the following:

Basic Usage

This console app initializes storage by creating a container, queue, and table:

public static void Main(string[] args)
{
    var account = CloudStorageAccount.Parse(args[0]);
    account.Ensure(containers: new [] { "mycontainer" }, queues: new [] { "myqueue" }, tables: new [] { "mytable" });
}

This console app tries to acquire a lease on a blob, and (if it succeeds), writes "Hello World" in the blob:

static void Main(string[] args)
{
    var blob = CloudStorageAccount.Parse(args[0]).CreateCloudBlobClient().GetBlobReference(args[1]);
    var leaseId = blob.TryAcquireLease();
    if (leaseId != null)
    {
        blob.UploadText("Hello, World!", leaseId);
        blob.ReleaseLease(leaseId);
        Console.WriteLine("Blob written!");
    }
    else
    {
        Console.WriteLine("Blob could not be leased.");
    }
}

This console app tests for the existence of a blob:

static void Main(string[] args)
{
    var blob = CloudStorageAccount.Parse(args[0]).CreateCloudBlobClient().GetBlobReference(args[1]);
    Console.WriteLine("The blob {0}.", blob.Exists() ? "exists" : "doesn't exist");
}
Something went wrong with that request. Please try again.