public T GetTombstoningData <T>(TombstoningType type, string id) where T : TombstoningDataBase { var entity = context.TombstoningDatas.FirstOrDefault(t => t.Type == type && t.Id == id); if (entity == null || entity.Data == null) { return(default(T)); } return(DeserializeObject <T>(entity.Data)); }
public void AddOrUpdateTombstoningData <T>(TombstoningType type, string id, T data) where T : TombstoningDataBase { lock (locker) { var entity = context.TombstoningDatas.FirstOrDefault(t => t.Type == type && t.Id == id); if (entity == null) { entity = new TombstoningData { Type = type, Id = id }; context.TombstoningDatas.InsertOnSubmit(entity); } entity.Data = SerializeObject(data); context.SubmitChanges(); } }