/// <summary> /// 取得数据库时间 /// </summary> /// <returns></returns> public DateTime GetDbDateTime() { //var date = this.DbInstance.Set<T>().Select(c=>SqlFunctions.GetDate()).FirstOrDefault(); //return date.Value; DateTime result; object obj = sqlhelper.GetSingle("select GETDATE()"); if (obj == null || !DateTime.TryParse(obj.ToString(), out result)) { result = DateTime.Now; } return(result); }