UserForMobileDbconn.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using Library;
  4. using System.Linq;
  5. using MySystem.MainModels;
  6. namespace MySystem
  7. {
  8. public class UserForMobileDbconn
  9. {
  10. public readonly static UserForMobileDbconn Instance = new UserForMobileDbconn();
  11. #region 获取单个字段
  12. public UserForMobile Get(string Mobile)
  13. {
  14. // string key = "UserForMobile:" + Mobile;
  15. // if (RedisDbconn.Instance.Exists(key))
  16. // {
  17. // UserForMobile obj = RedisDbconn.Instance.Get<UserForMobile>(key);
  18. // if (obj != null)
  19. // {
  20. // return obj;
  21. // }
  22. // }
  23. WebCMSEntities db = new WebCMSEntities();
  24. UserForMobile userFor = db.UserForMobile.FirstOrDefault(m => m.Mobile == Mobile);
  25. if (userFor != null)
  26. {
  27. // RedisDbconn.Instance.Set(key, userFor);
  28. // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
  29. }
  30. db.Dispose();
  31. return userFor;
  32. }
  33. #endregion
  34. }
  35. }