当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabase.Remove方法代码示例

本文整理汇总了C#中SqlDatabase.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabase.Remove方法的具体用法?C# SqlDatabase.Remove怎么用?C# SqlDatabase.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlDatabase的用法示例。


在下文中一共展示了SqlDatabase.Remove方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NotQueuedSanityCheckup

 private static void NotQueuedSanityCheckup()
 {
     lock (_dbLock)
     {
         using (var db = new SqlDatabase<NotQueuedEntry>(NotQueuedLocation))
         {
             const int secondsInWeek = 604800;
             var nowTime = Time.GetNowUnixTimestamp();
             var truncateTime = nowTime - secondsInWeek;
             var removing = false;
             var bubblesToTruncate = new List<NotQueuedEntry>();
             foreach (var possibleBubble in db.Store.Where(x => x.Time < truncateTime))
             {
                 if (!removing)
                 {
                     Utils.DebugPrint("Pruning not queued bubbles database. Some bubbles are too old!");
                 }
                 removing = true;
                 bubblesToTruncate.Add(possibleBubble);
             }
             foreach (var possibleBubble in bubblesToTruncate)
             {
                 db.Remove(possibleBubble);
             }
         }
     }
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:27,代码来源:BubbleQueueManager.cs

示例2: Load

 public static void Load()
 {
     lock (_lock)
     {
         using (var db = new SqlDatabase<BubbleGroupSettings>(GetPath()))
         {
             var toRemoves = new List<BubbleGroupSettings>();
             foreach (var settings in db.Store.ToList())
             {
                 var bubbleGroup = BubbleGroupManager.Find(settings.Guid);
                 if (bubbleGroup == null)
                 {
                     toRemoves.Add(settings);
                 }
                 else
                 {
                     bubbleGroup.Settings = settings;
                 }
             }
             if (toRemoves.Any())
             {
                 foreach (var toRemove in toRemoves)
                 {
                     db.Remove(toRemove);
                 }
             }
         }
     }
 }
开发者ID:StefanTischler,项目名称:DisaOpenSource,代码行数:29,代码来源:BubbleGroupSettingsManager.cs

示例3: PurgeBubble

 public static Task PurgeBubble(string bubbleId)
 {
     return Task.Factory.StartNew(() =>
     {
         lock (_dbLock)
         {
             using (var db = new SqlDatabase<Entry>(Location))
             {
                 foreach (var entry in db.Store.Where(x => x.Guid == bubbleId))
                 {
                     db.Remove(entry);
                 }
                 var sending = InsertBubble.Sending.FirstOrDefault(x => x.ID == bubbleId);
                 if (sending != null)
                 {
                     InsertBubble.Sending.Remove(sending);
                 }
             }
         }
     });
 }
开发者ID:Zaldroc,项目名称:DisaOpenSource,代码行数:21,代码来源:BubbleQueueManager.cs

示例4: Send

        public static Task<List<Receipt>> Send(string[] serviceNames, bool scheduled = false)
        {
            return Task<List<Receipt>>.Factory.StartNew(() =>
            {
                //PROCESS:  1) find all bubbles under serviceNames in db
                //          2) relate db entries to bubbles loaded into memory by Disa
                //          3) parallel send bubbles based respective to service
                //          4) delete all successful bubbles out of db

                lock (_sendLock)
                {
                    var possibleBubblesFromDatabase = new List<Entry>();

                    lock (_dbLock)
                    {
                        using (var db = new SqlDatabase<Entry>(Location))
                        {
                            foreach (var possibleBubble in db.Store.Where(x => serviceNames.Contains(x.ServiceName)).Reverse())
                            {
                                if (!InsertBubble.IsSending(possibleBubble.Guid))
                                {
                                    possibleBubblesFromDatabase.Add(possibleBubble);
                                }
                            }
                        }
                    }

                    var possibleBubblesInDisa = new List<Tuple<Entry, VisualBubble>>();
                    foreach (var bubbleGroup in BubbleGroupManager.BubbleGroupsNonUnified)
                    {
                        if (bubbleGroup.PartiallyLoaded)
                        {
                            continue;
                        }

                        foreach (var bubble in bubbleGroup)
                        {
                            if (bubble.Status != Bubble.BubbleStatus.Waiting)
                                continue;

                            var possibleBubbleFromDatabase = possibleBubblesFromDatabase.FirstOrDefault(x => x.Guid == bubble.ID);
                            if (possibleBubbleFromDatabase != null)
                            {
                                possibleBubblesInDisa.Add(new Tuple<Entry, VisualBubble>(possibleBubbleFromDatabase, bubble));
                            }
                        }
                    }

                    var sent = new List<Tuple<Entry, bool>>();

                    var possibleBubblesInDisaByService = possibleBubblesInDisa.GroupBy(x => x.Item1.ServiceName);
                    Parallel.ForEach(possibleBubblesInDisaByService, possibleBubblesInService =>
                    {
                        var failed = false;
                        foreach (var possibleBubble in possibleBubblesInService)
                        {
                            if (failed)
                            {
                                sent.Add(new Tuple<Entry, bool>(possibleBubble.Item1, false));
                                continue;
                            }

                            Utils.DebugPrint(">>>>>>>>>>> Sending queued bubble on "
                                + possibleBubble.Item2.Service.Information.ServiceName + "!");

                            var sendBubbleTask = BubbleManager.Send(possibleBubble.Item2, true);
                            sendBubbleTask.Wait();
                            if (sendBubbleTask.Result)
                            {
                                Utils.DebugPrint(">>>>>>>>> Successfully sent queued bubble on " +
                                    possibleBubble.Item2.Service.Information.ServiceName + "!");
                                sent.Add(new Tuple<Entry, bool>(possibleBubble.Item1, true));
                                lock (_dbLock)
                                {
                                    using (var db = new SqlDatabase<Entry>(Location))
                                    {
                                        db.Remove(possibleBubble.Item1);
                                    }
                                }
                                Utils.Delay(100).Wait();
                            }
                            else
                            {
                                Utils.DebugPrint(">>>>>>>>> Failed to send queued bubble on " +
                                    possibleBubble.Item2.Service.Information.ServiceName + "!");
                                sent.Add(new Tuple<Entry, bool>(possibleBubble.Item1, false));
                                failed = true; // fail the entire chain for this service from here on out so messages aren't sent out of order
                            }
                        }
                    });

                    SanityCheckup();

                    var receipts = sent.Select(x => new Receipt(x.Item1.Guid, x.Item2)).ToList();

                    if (!scheduled)
                    {
                        if (receipts.FirstOrDefault(x => !x.Success) != null)
                        {
                            ScheduleReSend(serviceNames);
//.........这里部分代码省略.........
开发者ID:Zaldroc,项目名称:DisaOpenSource,代码行数:101,代码来源:BubbleQueueManager.cs

示例5: Remove

 private static void Remove(Entry entry)
 {
     lock (_dbLock)
     {
         using (var db = new SqlDatabase<Entry>(Location))
         {
             db.Remove(entry);
         }
     }
 }
开发者ID:Zaldroc,项目名称:DisaOpenSource,代码行数:10,代码来源:BubbleQueueManager.cs

示例6: PurgeNotQueuedBubble

 public static Task PurgeNotQueuedBubble(string bubbleId)
 {
     return Task.Factory.StartNew(() =>
     {
         lock (_dbLock)
         {
             using (var db = new SqlDatabase<NotQueuedEntry>(NotQueuedLocation))
             {
                 foreach (var entry in db.Store.Where(x => x.Guid == bubbleId))
                 {
                     db.Remove(entry);
                 }
             }
         }
     });
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:16,代码来源:BubbleQueueManager.cs

示例7: Remove

 private static void Remove(Entry[] entries)
 {
     lock (_dbLock)
     {
         using (var db = new SqlDatabase<Entry>(Location))
         {
             foreach (var entry in entries)
             {
                 db.Remove(entry);
             }
         }
     }
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:13,代码来源:BubbleQueueManager.cs

示例8: RemoveNotQueued

 private static void RemoveNotQueued(VisualBubble bubble)
 {
     lock (_dbLock)
     {
         var bubbleId = bubble.ID;
         using (var db = new SqlDatabase<NotQueuedEntry>(NotQueuedLocation))
         {
             // don't add a duplicate group into the queue
             foreach (var possibleGroup in db.Store.Where(x => x.Guid == bubbleId))
             {
                 db.Remove(possibleGroup);
             }
         }
     }
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:15,代码来源:BubbleQueueManager.cs

示例9: Remove

 internal static void Remove(string[] groupIds)
 {
     lock (_dbLock)
     {
         using (var db = new SqlDatabase<Entry>(Location, false))
         {
             if (!db.Failed)
             {
                 foreach (var groupId in groupIds)
                 {
                     foreach (var item in db.Store.Where(x => !x.Unified && x.Guid == groupId))
                     {
                         db.Remove(item);
                     }
                 }
             }
         }
     }
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:19,代码来源:BubbleGroupIndex.cs


注:本文中的SqlDatabase.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。