public UserRole GetUserRole(UserRoleKey key) { UserRole userRole = null; string cacheKey = key == null ? "UserRoleKey_null" : key.GetCacheKey(); if (key != null && !TryGetCacheData(cacheKey, out userRole)) { userRole = GetUserRoleManager().Get(key); SetCacheData(_cacheName, cacheKey, userRole); } return userRole; }
/// <summary> /// Get data in database /// </summary> /// <param name="key">Primary Key</param> /// <returns>read data</returns> public UserRole Get(UserRoleKey key) { if (key == null || string.IsNullOrWhiteSpace(key.UserId) || string.IsNullOrWhiteSpace(key.RoleId)) return null; var row = _dbContext.UserRoles.Where(m => m.UserId == key.UserId && m.RoleId == key.RoleId).FirstOrDefault(); if (row != null) { return UserRoleTransformer.ToBean(row); } return null; }
public UserRole Get(UserRoleKey key) { return _userRoleModule.Get(key); }