Skip to content

Instantly share code, notes, and snippets.

@tylerd
Created April 7, 2012 19:46
Show Gist options
  • Save tylerd/2331629 to your computer and use it in GitHub Desktop.
Save tylerd/2331629 to your computer and use it in GitHub Desktop.
Table Data Context Using Composition
public class DataContext
{
private TableServiceContext _context;
public DataContext()
{
var account = CloudStorageAccount.FromConfigurationSetting("DataContext");
_context= account.CreateCloudTableClient().GetDataServiceContext();
}
public void AddMeeting(Meeting meeting)
{
_context.AddObject("Meetings", meeting);
}
public IQueryable<Meeting> Meetings
{
get{
return _context.CreateQuery<Meeting>("Meetings");
}
}
public void SaveChanges()
{
_context.SaveChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment