Created
April 7, 2012 19:46
-
-
Save tylerd/2331629 to your computer and use it in GitHub Desktop.
Table Data Context Using Composition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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