public override void OnException(ExceptionContext filterContext) { T_Log log = new T_Log(); //ToTest log.UserId = 1; log.UserName = "******"; //log.UserId = Convert.ToInt32(filterContext.HttpContext.Session["UserId"]); //log.UserName = filterContext.HttpContext.Session["UserName"].ToString(); log.IpAddress = NetHelper.GetPrivateIPAddress(); log.Controller = filterContext.GetController(); log.Action = filterContext.GetAction(); log.Remark = filterContext.Exception.Message; log.CreateDate = DateTime.Now; //ToTest //using (DBEntity db = new DBEntity()) //{ // db.Log.AddObject(log); // db.SaveChanges(); //} }
/// <summary> /// Deprecated Method for adding a new object to the T_Log EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_Log(T_Log t_Log) { base.AddObject("T_Log", t_Log); }
/// <summary> /// Create a new T_Log object. /// </summary> /// <param name="id">Initial value of the Id property.</param> public static T_Log CreateT_Log(global::System.Int32 id) { T_Log t_Log = new T_Log(); t_Log.Id = id; return t_Log; }