상속: DbContext, ISourceLogContext
예제 #1
0
 public void LoadChangedFiles()
 {
     if (ChangedFiles == null)
     {
         using (var db = new SourceLogContext())
         {
             ChangedFiles = db.LogEntries.Where(x => x.LogEntryId == LogEntryId).Include(x => x.ChangedFiles).Single().ChangedFiles;
         }
     }
 }
 public LogSubscription AddLogSubscription(string name, string logProviderTypeName, string url)
 {
     var logSubscription = new LogSubscription(name, logProviderTypeName, url) { Log = new TrulyObservableCollection<LogEntry>() };
     using (var db = new SourceLogContext())
     {
         db.LogSubscriptions.Add(logSubscription);
         db.SaveChanges();
     }
     logSubscription.NewLogEntry += (o, e) => NewLogEntry(o, e);
     LogSubscriptions.Add(logSubscription);
     return logSubscription;
 }
예제 #3
0
 public void MarkAsReadAndSave()
 {
     Task.Factory.StartNew(() =>
     {
         using (var db = new SourceLogContext())
         {
             //var logEntry = db.LogEntries.Find(LogEntryId);
             var logEntry = db.LogEntries.Where(le => le.LogEntryId == LogEntryId).Include(le => le.LogSubscription).Single();
             db.LogEntries.Attach(logEntry);
             logEntry.Read = true;
             db.SaveChanges();
         }
     });
 }
예제 #4
0
        public LogSubscription AddLogSubscription(string name, string logProviderTypeName, string url)
        {
            var logSubscription = new LogSubscription(name, logProviderTypeName, url)
            {
                Log = new TrulyObservableCollection <LogEntry>()
            };

            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Add(logSubscription);
                db.SaveChanges();
            }
            logSubscription.NewLogEntry += (o, e) => NewLogEntry(o, e);
            LogSubscriptions.Add(logSubscription);
            return(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);
 }
예제 #6
0
 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);
 }
예제 #7
0
        public void Update(string name, string pluginName, string settingsXml)
        {
            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Attach(this);

                Name           = name;
                PluginTypeName = pluginName;
                Url            = settingsXml;

                db.SaveChanges();
            }

            // Not sure if this is necessary
            LogProvider.NewLogEntry     -= AddNewLogEntry;
            LogProvider.PluginException -= LogProviderLogProviderException;

            LoadPlugin();
        }
예제 #8
0
 public void MarkAsReadAndSave()
 {
     Task.Factory.StartNew(() =>
         {
             using (var db = new SourceLogContext())
             {
                 //var logEntry = db.LogEntries.Find(LogEntryId);
                 var logEntry = db.LogEntries.Where(le => le.LogEntryId == LogEntryId).Include(le => le.LogSubscription).Single();
                 db.LogEntries.Attach(logEntry);
                 logEntry.Read = true;
                 db.SaveChanges();
             }
         });
 }
예제 #9
0
 public void LoadChangedFiles()
 {
     if (ChangedFiles == null)
     {
         using (var db = new SourceLogContext())
         {
             ChangedFiles = db.LogEntries.Where(x => x.LogEntryId == LogEntryId).Include(x => x.ChangedFiles).Single().ChangedFiles;
         }
     }
 }
예제 #10
0
        public void Update(string name, string pluginName, string settingsXml)
        {
            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Attach(this);

                Name = name;
                PluginTypeName = pluginName;
                Url = settingsXml;

                db.SaveChanges();
            }

            // Not sure if this is necessary
            LogProvider.NewLogEntry -= AddNewLogEntry;
            LogProvider.PluginException -= LogProviderLogProviderException;

            LoadPlugin();
        }