Available on Nugethttp://nuget.org/packages/StorageExtensions

Project Description

This library add LINQ syntax to the method Where on TableQuery<T>
This support actually Windows Azure Storage Library V2.0

 

You can find a library to create your Table Queries with Linq Support.

With the SDK 1.8, Windows Azure provides a new library to access on your Table Storage, but these doesn’t permit to use Linq on Where method. So i have created a library to add Linq Support.

To use this library, you must reference the assembly, and add “using AzureStorageExtensions

You can find below the use case that i have tested for the current version of this library :

 

query = new TableQuery<TestEntity>().Where(n => n.PartitionKey == "42");

query = new TableQuery<TestEntity>().Where(n => n.PartitionKey != "42");

query = new TableQuery<TestEntity>().Where(n => n.Integer > 42);

query = new TableQuery<TestEntity>().Where(n => n.Integer >= 42);

query = new TableQuery<TestEntity>().Where(n => n.Integer < 42);

query = new TableQuery<TestEntity>().Where(n => n.Integer <= 42);

query = new TableQuery<TestEntity>().Where(n => n.PartitionKey == "42" && n.RowKey == "42");

query = new TableQuery<TestEntity>().Where(n => n.PartitionKey == "42" || n.RowKey == "42");

query = new TableQuery<TestEntity>().Where(n => n.Date == DateTime.Now);

DateTime date = DateTime.Now;
query = new TableQuery<TestEntity>().Where(n => n.Date == date);

query = new TableQuery<TestEntity>().Where(n => n.Date == new DateTime(2012, 10, 5));

query = new TableQuery<TestEntity>().Where(n => n.IsEnabled == true);

query = new TableQuery<TestEntity>().Where(n => n.IsEnabled);

query = new TableQuery<TestEntity>().Where(n => !n.IsEnabled);

query = new TableQuery<TestEntity>().Where(n => n.UniqueIdentifier == Guid.Empty);

Guid guid = Guid.Empty;
query = new TableQuery<TestEntity>().Where(n => n.UniqueIdentifier == guid);

query = new TableQuery<TestEntity>().Where(n => n.UniqueIdentifier == Guid.Parse("52317684-641D-40C0-86C7-9B57DF97AC7F"));

query = new TableQuery<TestEntity>().Where(n => n.Text == String.Format("{0} ipsum", "Lorem"));

Version 1.1 Add Feature and more request are available

query = new TableQuery<TestEntity>().Where(n => "42" == n.PartitionKey);

query = new TableQuery<TestEntity>().Where(n => "42" != n.PartitionKey);

query = new TableQuery<TestEntity>().Where(n => 42 > n.Integer);

query = new TableQuery<TestEntity>().Where(n => 42 <= n.Integer);

query = new TableQuery<TestEntity>().Where(n => 42 > n.Integer);

query = new TableQuery<TestEntity>().Where(n => 42 >= n.Integer);

query = new TableQuery<TestEntity>().Where(n => "42" == n.PartitionKey && "42" == n.RowKey);

query = new TableQuery<TestEntity>().Where(n => "42" == n.PartitionKey || "42" == n.RowKey);

query = new TableQuery<TestEntity>().Where(n => DateTime.Now == n.Date);

DateTime date = DateTime.Now;
query = new TableQuery<TestEntity>().Where(n => date == n.Date);

query = new TableQuery<TestEntity>().Where(n => new DateTime(2012, 10, 5) == n.Date);

query = new TableQuery<TestEntity>().Where(n => true == n.IsEnabled);

query = new TableQuery<TestEntity>().Where(n => n.IsEnabled);

query = new TableQuery<TestEntity>().Where(n => !n.IsEnabled);

query = new TableQuery<TestEntity>().Where(n => Guid.Empty == n.UniqueIdentifier);

Guid guid = Guid.Empty;
query = new TableQuery<TestEntity>().Where(n => guid == n.UniqueIdentifier);

query = new TableQuery<TestEntity>().Where(n => Guid.Parse("52317684-641D-40C0-86C7-9B57DF97AC7F") == n.UniqueIdentifier);

query = new TableQuery<TestEntity>().Where(n => String.Format("{0} ipsum", "Lorem") == n.Text);

Wilfried Woivré

MVP Windows Azure – Soat Expert Azure

My french blogs : http://blog.woivre.frhttp://blog.soat.fr

My twitter : http://twitter.com/wilfriedwoivre - http://twitter.com/SoatExpertsNET 

My Azure User Group : http://zecloud.fr

Last edited Dec 15, 2012 at 3:31 PM by wilfriedwoivre, version 7