c# - How can I filter for specific information from an EntityCollection? -


i'd display grade information each student in results variable.

the way database set is:

grade --- gradestudent --- student 

so each different year, have unique gradestudent record holding grade's id, , students id, year of record.

i used entity framework 4 orm, , i'd display grade name in datagridview each student.

private void btnsearch_click(object sender, eventargs e) {     studentrepository repo = new studentrepository();     var results =         repo.findallstudents().where(             s =>             s.name == txtsearchquery.text ||              s.lastnamefather == txtsearchquery.text ||             s.lastnamemother == txtsearchquery.text);      datagridview1.datasource = results.select(s => new     {         codigo = s.studentid,         nombre = s.lastnamefather + " " + s.lastnamemother + ", " + s.name,         sexo = s.sex,         telefono = s.telephone     }).tolist(); } 

if try following, can invoke entitycollection collection, since there can many gradestudent objects associated student. 1 each year.

so need grade in during x year.

do have suggestions on how accomplish this?

if understand question - looking grade object (via gradestudent middle table). if case, need create navigationproperty in ef model relate grade gradestudent(* - 1) , gradestudent student (0..1 - *).

as fetching data context, silverlight app using ria? if so, getstudentsquery method in service need include entities data returned student object.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -