Esempio n. 1
0
        public virtual void Delete(List <string> ids)
        {
            using (new TimeMonitor(GetPrefix(ids)))
            {
                try
                {
                    LogWarning("Delete", string.Join(",", ids));
                    var task = Task.Run(async() => { await collection.DeleteEntitiesAsync(ids); });
                    task.Wait();

                    foreach (var id in ids)
                    {
                        if (typeof(T) != typeof(HistoryService))
                        {
                            ProcessHistory(HistoryType.Delete, id, "", this.GetContext().UserId);
                        }
                    }

                    if (this.GetContext().IsUseCache&& IsCacheReady())
                    {
                        cache.Remove(ids);
                    }
                }
                catch (Exception ex)
                {
                    LogException(ex);
                    return;
                }
            }
        }
Esempio n. 2
0
        public virtual void Delete(List <string> ids)
        {
            using (new TimeMonitor(GetPrefix(ids)))
            {
                try
                {
                    LogWarning("Delete", string.Join(",", ids));
                    var task = Task.Run(async() => { await collection.DeleteEntitiesAsync(ids); });
                    task.Wait();

                    if (IsCacheReady())
                    {
                        cache.Remove(ids);
                    }
                }
                catch (Exception ex)
                {
                    LogException(ex);
                    return;
                }
            }
        }