Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Useful extension methods for Windows Azure storage operations that aren't covered by the .NET client library
C#
branch: master
Failed to load latest commit information.
.nuget adding dependency on WindowsAzure.StorageClient 1.7
Properties DateTime is awful. DateTimeOffset is the replacement.
.gitignore
AutoRenewLease.cs DateTime is awful. DateTimeOffset is the replacement.
ExistenceExtensions.cs
InitializationExtensions.cs Adding August 2011 storage features: queue message updates, table ups…
LICENSE adding Ms-PL license
LeaseExtensions.cs better handle exceptions with no response (by bubbling them up)
README.md get rid of samples no longer relevant
WazStorageExtensions.csproj remove things that are now covered by the official .NET storage clien…
WazStorageExtensions.nuspec adding dependency on WindowsAzure.StorageClient 1.7
WazStorageExtensions.sln initial commit
build.cmd initial commit
packages.config adding dependency on WindowsAzure.StorageClient 1.7

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.