public void InsertTest() { PerformanceLogDataSource target = new PerformanceLogDataSource(); PerformanceLog item = new PerformanceLog("job", Guid.NewGuid().ToString(), DateTime.UtcNow, DateTime.UtcNow.AddSeconds(10)); target.Insert(item); var results = (target.PerformanceLogs.Where(log => log.PartitionKey == item.PartitionKey && log.RowKey == item.RowKey) as DataServiceQuery<PerformanceLog>).Execute().ToList(); Assert.IsTrue(results.Count() >= 1); Assert.AreEqual(item.PartitionKey, results.First().PartitionKey); }
public void Update(PerformanceLog item) { try { ServiceContext.AttachTo(PerformanceLogContext.PerformanceLogTableName, item); } catch (InvalidOperationException e) // Context is already tracking the entity { } ServiceContext.UpdateObject(item); ServiceContext.SaveChanges(); }
public void Insert(PerformanceLog item) { ServiceContext.AddObject(PerformanceLogContext.PerformanceLogTableName, item); ServiceContext.SaveChanges(); }
public void Delete(PerformanceLog item) { ServiceContext.AttachTo(PerformanceLogContext.PerformanceLogTableName, item); ServiceContext.DeleteObject(item); ServiceContext.SaveChanges(); }