/// <summary> /// 根据角色ID获取角色信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public Roles GetRoleByID(string id) { if (id == null) { id = string.Empty; } var data = from r in RoleList.AsNoTracking() where r.RoleID == id select r; if (data.Count() > 0) { return(data.First()); } else { return(null); } }