Search Wiki:

Description

This library uses the REST API against SQL Data Services and performs CRUD & Query operations. It features a powerful LINQ-based query and serialization model to make working with objects and SDS very simple.

Change Log:


20081011 Refresh Release
  • Updated the serialization mechanism to run in partial trust. This allows it to run inside Windows Azure projects.
  • Minor refactoring

20080904 Release
  • added support for blobs, concurrency, and parallelism

initial release
  • LINQ query syntax and strongly typed object support.
  • Simple predicates are translated to SQL Data Services Syntax automatically
  • Support for flexible properties in addition to strongly typed properties
  • Paging support
  • Support for multiple return types from query

Future Features

  • Add support for JOIN syntax, Take syntax, OrderBy syntax
  • Implement fully IQueryable model for the remaining features

Sample Syntax


var container = Context.OpenContainer("querytests");
var foo = new Foo { IsPublic = false, Name = "MyFoo", Size = 12 };
 
//insert it with unique id guid string
container.Insert(foo, Guid.NewGuid().ToString());
 
//notice the LINQ syntax on strong type "Foo"
var results = container.Query<Foo>(e => e.Entity.Size > 2);

This release also supports blobs via the SsdsBlobEntity both synchronously as well as async

MemoryStream mem = new MemoryStream();
//load memory stream
//...
//now upload it to service
using (SsdsBlobEntity blob = new SsdsBlobEntity(mem))
{
    blob.ContentDisposition = "violin.jpg";
    blob.MimeType = @"image/jpeg";
    blob.Id = Guid.NewGuid().ToString();
    var container = Context.OpenContainer("blobtests");
    container.Insert(blob);
}

Concurrency using If-Match and If-None-Match headers is supported as well.

var table = Context.OpenContainer("foo");
 
//create new foo
var foo = new Foo { IsPublic = false, Name = "Foo", Size = 10 };
string id = Guid.NewGuid().ToString();
table.Insert(foo, id);
 
//update entity if none match (different version)
SsdsEntity<Foo> entity = new SsdsEntity<Foo>();
entity.Entity = foo;
entity.Id = id;            
entity.Entity.Name = "Foo2";
 
table.Update(entity, ConcurrencyPattern.IfNoneMatch);

This release also supports parallelism to the SSDS service using the Parallel Extensions. This support is extensible to other techniques using extension methods.

var container = Context.OpenContainer("paging");
 
List<SsdsEntity<Foo>> entities = new List<SsdsEntity<Foo>>();
 
for (int i = 0; i < 10; i++)
{
    var foo = new Foo
    {
        IsPublic = false,
        Name = "Foo" + i,
        Size = i
    };
 
    entities.Add(new SsdsEntity<Foo>() { Entity = foo, Id = foo.Name });
}
 
Exception ex = null;
 
container.Insert<Foo>(entities, (ent, excep) =>
{
    ex = excep;
    return false;
});
 
if (ex != null)
{
    throw ex;
}

More information about this provider can be found in the related blog postings:

Serialization in SSDS
Working with Objects in SSDS Part 1
Working with Objects in SSDS Part 2
Working with Objects in SSDS Part 3
Last edited Nov 12 2008 at 5:35 AM  by dunnry, version 5
Comments
pstatho wrote  Nov 27 2008 at 7:09 PM  
Awesome library! Great work, it's exactly what I was looking for

Updating...
Page view tracker