linq를 사용하여 엔티티에 대한 linq를 사용하여 데이터를 가져 오는 중, 관계가 주요 기본 키에있는 테이블간에 존재하지만 결과 집합이 나타납니다. 그러나 모든 행은 재귀 적으로 여러 번 반복됩니다. 그러나 Db 행이 중복되지 않습니다. 이 문제를 해결하는 방법을 이해할 수 없습니다.ASP.net Entity Framework 행이 중복 반환 됨
StringBuilder sb = new StringBuilder();
string text = txtBoxSearch.Text;
OLSContainer ols = new OLSContainer();
var result = from tex in ols.COURSEs
from another in ols.UNITs
where tex.courseName.Contains(text) || tex.description.Contains(text) || another.unitName.Contains(text)
select new { tex,another };
foreach (var cours in result)
{
sb.AppendLine("<h2 id='" + cours.tex.courseID + "'><a href='admin.aspx?id='" + cours.tex.courseID + "''>" + cours.tex.courseName + "</a></h2>");
}
foreach (var cours in result)
{
sb.AppendLine("<h2 id='" + cours.another.unitID + "'><a href='admin.aspx?id='" + cours.another.unitID + "''>" + cours.another.unitName + "</a></h2>");
}
SQL 쿼리는 프로파일 러에서 어떤 모습입니까? 또한 과정과 단위 간의 완벽한 관계는 무엇입니까? 그것은 일 대 다입니까? – IronMan84