Beispiel #1
0
        public static void AddLog(string xml)
        {
            LogsContext context = new LogsContext();

            SearchLog myLog = new SearchLog();
            myLog.Date = DateTime.Now;
            myLog.QueryXml = xml.ToString();

            context.SearchLogs.Add(myLog);
            context.SaveChanges();
        }
Beispiel #2
0
 public DB(bool resetBookstore, bool resetLog, LogsContext log)
 {
     if (resetBookstore)
     {
         ResetDbData();                       
     }
     if (resetLog)
     {
         log.Database.ExecuteSqlCommand("DELETE Logs");
         log.SaveChanges();
     }
     this.log = log;
 }
    public static void AddLog(DateTime date, string query)
    {
        Database.SetInitializer(new MigrateDatabaseToLatestVersion
            <LogsContext, Logs.Data.Migrations.Configuration>());

        LogsContext context = new LogsContext();
        using (context)
        {
            SearchLog log = new SearchLog();
            log.Date = date;
            log.QueryXml = query;
            context.SearchLogs.Add(log);
            context.SaveChanges();
        }
    }