示例#1
0
 internal static List <Trace> GetExceptionsFromDB(string databaseConnectionString)
 {
     using (var db = new TracingDataContext(databaseConnectionString))
     {
         return(db.Traces.Where(e => e.Level == 2).ToList());
     }
 }
示例#2
0
 internal static Trace GetFirstLog(string databaseConnectionString)
 {
     using (var db = new TracingDataContext(databaseConnectionString))
     {
         return(db.Traces.FirstOrDefault());
     }
 }
示例#3
0
 internal static List <Trace> GetAllLogEntries(string databaseConnectionString)
 {
     using (var db = new TracingDataContext(databaseConnectionString))
     {
         return(db.Traces.ToList());
     }
 }
示例#4
0
 internal static void CleanLoggingDB(string databaseConnectionString)
 {
     using (var db = new TracingDataContext(databaseConnectionString))
     {
         db.Traces.DeleteAllOnSubmit(db.Traces);
         db.SubmitChanges();
     }
 }
示例#5
0
        internal static string GetFirstLogFormattedMessage(string databaseConnectionString)
        {
            using (var db = new TracingDataContext(databaseConnectionString))
            {
                var log = db.Traces.Where(e => e.FormattedMessage.Contains("Extended Properties: value - testing title")).SingleOrDefault();
                if (log == null)
                {
                    return(null);
                }

                return(log.FormattedMessage);
            }
        }