void submitBrfToDB(DateTime roundedTime, byte[] data) { StreamMoment briefToSave = new StreamMoment() { SnapshotTime = roundedTime, Data = data }; bool submitSuccess = false; try { dc.StreamMoments.InsertOnSubmit(briefToSave); dc.SubmitChanges(); submitSuccess = true; } catch (Exception ex) { logger.Error("Exception with SubmitChanges() (will try again): {0}", ex.Message); } if (!submitSuccess) { logger.Error("Trying SubmitChanges() a second time."); try { dc.Connection.Close(); dc = new DataClasses1DataContext(); dc.StreamMoments.InsertOnSubmit(briefToSave); dc.SubmitChanges(); logger.Info("SubmitChanges() okay on second try."); } catch (Exception ex) { logger.Error("Exception with SubmitChanges() on second try: {0}", ex.Message); } } }
partial void DeleteStreamMoment(StreamMoment instance);
partial void UpdateStreamMoment(StreamMoment instance);
partial void InsertStreamMoment(StreamMoment instance);