UserForMakerCodeDbconn.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 UserForMakerCodeDbconn
  9. {
  10. public readonly static UserForMakerCodeDbconn Instance = new UserForMakerCodeDbconn();
  11. #region 获取单个字段
  12. public UserForMakerCode Get(string MakerCode)
  13. {
  14. // string key = "UserForMakerCode:" + MakerCode;
  15. // if (RedisDbconn.Instance.Exists(key))
  16. // {
  17. // UserForMakerCode obj = RedisDbconn.Instance.Get<UserForMakerCode>(key);
  18. // if (obj != null)
  19. // {
  20. // return obj;
  21. // }
  22. // }
  23. WebCMSEntities db = new WebCMSEntities();
  24. UserForMakerCode order = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
  25. if (order != null)
  26. {
  27. // RedisDbconn.Instance.Set(key, order);
  28. // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
  29. }
  30. db.Dispose();
  31. return order;
  32. }
  33. #endregion
  34. }
  35. }