| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections.Generic;
- using Library;
- using System.Linq;
- using MySystem.MainModels;
- namespace MySystem
- {
- public class UserMachineDataDbconn
- {
- public readonly static UserMachineDataDbconn Instance = new UserMachineDataDbconn();
- #region 获取单个字段
- public UserMachineData Get(string IdBrand)
- {
- // string key = "UserMachineData:" + IdBrand;
- // if (RedisDbconn.Instance.Exists(key))
- // {
- // UserMachineData obj = RedisDbconn.Instance.Get<UserMachineData>(key);
- // if (obj != null)
- // {
- // return obj;
- // }
- // }
- WebCMSEntities db = new WebCMSEntities();
- UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
- if (userData != null)
- {
- // RedisDbconn.Instance.Set(key, userData);
- // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
- }
- db.Dispose();
- return userData;
- }
- #endregion
- }
- }
|