public void DeleteSubscription(LogSubscription logSubscription) { logSubscription.LogProvider.Dispose(); logSubscription.UnsubscribeEvents(); using (var db = new SourceLogContext()) { foreach (var logEntry in logSubscription.Log) { logEntry.ChangedFiles = null; logEntry.LogSubscription = logSubscription; } db.LogSubscriptions.Attach(logSubscription); db.LogSubscriptions.Remove(logSubscription); db.SaveChanges(); } _logSubscriptions.Remove(logSubscription); }
public void DeleteSubscription(LogSubscription logSubscription) { logSubscription.LogProvider.Dispose(); logSubscription.UnsubscribeEvents(); using (var db = new SourceLogContext()) { foreach (var logEntry in logSubscription.Log) { logEntry.ChangedFiles = null; logEntry.LogSubscription = logSubscription; } db.LogSubscriptions.Attach(logSubscription); db.LogSubscriptions.Remove(logSubscription); db.SaveChanges(); } _logSubscriptions.Remove(logSubscription); }