The functionality is implemented in DocaLabs.Storage and DocaAzure.Storage.

Support for IDbSet greatly simplifies access to Azure Table Storage. This way the developing for Azure Tables will very much like for Entity Framework with a few major differences - there is no relational support and as the underlying context is TableServiceContext you will need to mark explicitly that the entity was modified

        var product = productContext.Products.Find(categoryId, productId); // it will automatically convert Guid to string
        product.Name = "Changed Name";

To do this you will need a few simple steps:

1. Define the entity
        public class Product : SimpleEntity
            public const string TableName = "Products";

            public Product()

            public Product(Guid categoryId, Guid productId)
                : base(categoryId.ToString(), productId.ToString())

            public string Name { get; set; }

2. Define the context interface
        public interface IProductContext : ISimpleContextBase
            IDbSet<Product> Products { get; set; }

3. Then generate the context and use it. The type definition will be cached so the time penalty will be only the first time the context is generated
        var productContext = SimpleContextBase.CreateInstance<IProductContext>();
        productContext.Product.Add(new Product(Guid.NewGuid(), Guid.NewGuid()) { Name = "First Product" });

It's could be very useful to be used together with IoC containers, for Castle Windsor the registration code may look like:

The feature also automatically adds support for continuation token for Linq queries by transparently using CloudTableQuery.

Last edited May 14, 2011 at 12:27 PM by alexeikadyrov, version 2


No comments yet.