private bool TryGetLastSuccessfullRead(ServiceContext context, out TimeoutManagerDataEntity lastSuccessfullReadEntity) { try { lastSuccessfullReadEntity = (from m in context.TimeoutManagerData where m.PartitionKey == Configure.EndpointName select m).FirstOrDefault(); } catch { lastSuccessfullReadEntity = null; } return(lastSuccessfullReadEntity != null); }
private void UpdateSuccesfullRead(ServiceContext context, TimeoutManagerDataEntity read) { if (read == null) { read = new TimeoutManagerDataEntity(Configure.EndpointName, string.Empty) { LastSuccessfullRead = DateTime.UtcNow }; context.AddObject(ServiceContext.TimeoutManagerDataEntityTableName, read); } else { read.LastSuccessfullRead = DateTime.UtcNow; context.UpdateObject(read); } context.SaveChanges(SaveChangesOptions.ReplaceOnUpdate); }
private void UpdateSuccesfullRead(ServiceContext context, TimeoutManagerDataEntity read) { if (read == null) { read = new TimeoutManagerDataEntity(Configure.EndpointName, string.Empty){ LastSuccessfullRead = DateTime.UtcNow }; context.AddObject(ServiceContext.TimeoutManagerDataEntityTableName, read); } else { read.LastSuccessfullRead = DateTime.UtcNow; context.UpdateObject(read); } context.SaveChanges(SaveChangesOptions.ReplaceOnUpdate); }
private bool TryGetLastSuccessfullRead(ServiceContext context, out TimeoutManagerDataEntity lastSuccessfullReadEntity) { try { lastSuccessfullReadEntity = (from m in context.TimeoutManagerData where m.PartitionKey == Configure.EndpointName select m).FirstOrDefault(); } catch { lastSuccessfullReadEntity = null; } return lastSuccessfullReadEntity != null; }