ADO.net을 통해 만든 1 : 많은 관계 및 대량 삽입이 LINQ-SQL 데이터 컨텍스트로 전파되지 않습니다.Ado.net 삽입 후 C# Linq-to-SQL이 업데이트되지 않음
TABLE School
int schoolId
int maxStudents
...
TABLE Students
int studentId
int schoolId
DateTime birthdate
...
나는 Students
테이블, 말, 500 명 학생을 추가 일괄, 내 데이터 컨텍스트가 .Students를 업데이트하지 않습니다. 그냥 여기 .Students.Count() == 0입니다
편집을 말한다 예입니다 :
// Create a Repository
Repository Repo = new Repository();
string[] schoolNames = GetSchoolNames();
// Pull in the schools.
IEnumerable<School> schools = Repo.GetSchools(schoolNames);
foreach (School school in schools) school.DoSomeDirectDBWork();
schoolNames = schools.Select(school => school.name).ToArray();
Repo.Dispose(); // Flush/Close/Dispose
Repo = new Repository(); // New repository, new data context.
schools = Repo.GetSchools(schoolNames);
// ** THE SCHOOLS HAVE NO STUDENTS AT THIS POINT IN THE CODE.
// ** <SAD FACE>
삽입물을 삽입하는 곳의 코드를 표시하십시오. – Yuck
어떤 데이터베이스 공급 업체입니까? – sgtz
@sgtz LINQ-to-SQL = 나쁜 일을하지 않는 한 SQL 서버 –