1
그래서 임 내 GET 요청에서 컬렉션을 반환하고 나는 오히려 개별적으로보다 anyofthebelow
에 따라 그룹 반환 할주의 :Linq에 WCF 서비스에
이
성
FIRSTNAME을 StudentID을
나는 아래의 코드에서이를 수행하는 동안 각자 다른 GET 메소드를 작성하는 방법 만 알고있다. 내가 GetStudentCollectionByGroup(string anything)
라고 부를 수 있고 각 클라이언트에 대해 아래의 방법을 수행 할 필요없이 클라이언트의 위의 목록을 반환 할 수있는 방법은 무엇입니까? StudentID, FirstName, LastName
? 예를 들어
public List<Group> GetStudentCollectionByGroup(string studentID)
{
List<Group> groups = (from g in Groups
where
(from t in g.Groupsz where t.StudentID == studentID select t).Count() > 0
select g).ToList();
return groups;
}
public List<Group> GetStudentCollectionByGroup(string firstName)
{
List<Group> groups = (from g in Groups
where
(from t in g.Groupsz where t.FirstName == firstName select t).Count() > 0
select g).ToList();
return groups;
}
:
from t in g.Groupsz where t.StudentID == studentID select t
는 OR 방법이 있습니까? 뭔가 같은 :에
where t.StudentID == anything OR t.FirstName == anything etc
p.s 매우 확실하지 않은 방법으로 단어이의 제목 (편집 환영) 물론
이름 비교에서 케이스 감각을 봅니다. 밥! = 밥! = 밥. String.Compare와 같은 대/소문자를 제어 할 수있는 비교 메서드를 사용해야합니다. – user957902