using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Samples.ServiceHosting.StorageClient;
namespace newtelligence.DasBlog.Runtime.Azure{
public class BlogEntryServiceContext : TableStorageDataServiceContext
{
public BlogEntryServiceContext(StorageAccountInfo accountInfo) :
base(accountInfo)
{
// ...
}
public IQueryable<BlogEntryEntity> Entries
{
get
{
return this.CreateQuery<BlogEntryEntity>("Entries");
}
}
public void AddEntry(BlogEntryEntity entry)
{
if (entry == null) { throw new ArgumentNullException("entry"); }
this.AddObject("Entries", entry);
this.SaveChanges();
}
public void UpdateEntry(BlogEntryEntity entry)
{
if (entry == null) { throw new ArgumentNullException("entry"); }
this.UpdateObject(entry);
this.SaveChanges();
}
public void DeleteEntry(BlogEntryEntity entry)
{
if (entry == null) { throw new ArgumentNullException("entry"); }
this.DeleteObject(entry);
this.SaveChanges();
}
}
}
|