adding IEntityRelation in IRelationCollection

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 04-Mar-2011 17:52:04   

Hi, i have the following piece of code:

IRelationCollection relations = new RelationCollection { StudentFinalGradeByClassEntity.Relations.EnrollmentEntityUsingStudentIdClassIdSemesterIdAcademicTermId, EnrollmentEntity.Relations.AcademicTermEntityUsingAcademicTermId, AcademicTermEntity.Relations.AcademicYearEntityUsingAcademicYearId, EnrollmentEntity.Relations.ClassAcademicSemesterEntityUsingClassIdSemesterId, ClassAcademicSemesterEntity.Relations.ClassEntityUsingClassId, ClassEntity.Relations.CourseEntityUsingCourseId };

        IEntityRelation relation1 = new EntityRelation(StudentFinalGradeByClassFields.StudentId, StudentHistoryFields.StudentId, RelationType.ManyToMany);
        IEntityRelation relation2 = new EntityRelation(StudentFinalGradeByClassFields.AcademicTermId, StudentHistoryFields.AcademicTermId, RelationType.ManyToMany);
        relations.Add(relation1);
        relations.Add(relation2);

and somehow only relation1 is added in relations. if i change the order as relations.Add(relation2); relations.Add(relation1);

then only relation2 is added into the collection. Somehow second add is always omitted. (checked it through generated sql).

Am i doing something wrong here?

thanks -shane

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Mar-2011 23:06:21   

I guess the relation is added to the collection but you don't see it in the generated code. It could be the relation is redundant.

Could you please show us the generated sql for that very code? What is your Runtime Library version?

David Elizondo | LLBLGen Support Team