public void Log(string source, string message, string data, string stackTrace, string targetSite, ErrorLevels errorLevel, string customMessage) { ErrorEdm edm = new ErrorEdm(); ErrorLog log = new ErrorLog { Source = source, Message = message, Data = data, StackTrace = stackTrace, TargetSite = targetSite, ErrorLevel = errorLevel.ToString(), ErrorDate = DateTime.Now, CustomMessage = customMessage }; edm.AddObject("ErrorLogs", log); edm.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the ErrorLogs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToErrorLogs(ErrorLog errorLog) { base.AddObject("ErrorLogs", errorLog); }
/// <summary> /// Create a new ErrorLog object. /// </summary> /// <param name="errorId">Initial value of the ErrorId property.</param> /// <param name="errorLevel">Initial value of the ErrorLevel property.</param> /// <param name="errorDate">Initial value of the ErrorDate property.</param> public static ErrorLog CreateErrorLog(global::System.Int32 errorId, global::System.String errorLevel, global::System.DateTime errorDate) { ErrorLog errorLog = new ErrorLog(); errorLog.ErrorId = errorId; errorLog.ErrorLevel = errorLevel; errorLog.ErrorDate = errorDate; return errorLog; }