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