Example #1
0
        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);
                }
            }
        }
Example #2
0
 partial void DeleteStreamMoment(StreamMoment instance);
Example #3
0
 partial void UpdateStreamMoment(StreamMoment instance);
Example #4
0
 partial void InsertStreamMoment(StreamMoment instance);