none
Related entity is read-only RRS feed

  • Question

  • Hi

    I have a LINQ as below to bring an entity Applicants and a related entity ApplicantNotes;

    Dim Query = From a In Context.Applicants Where ... Select a.ApplicantID, a.first_name, a.last_name, AppNotes = a.ApplicantNotes.Select(Function(n) New With {.Note = n.Note, .DateModified = n.DateModified})
    

    I then assign two binding sources as below one each for entity and related entity. 

    ApplicantBindingSource.DataSource = Query.ToList()
    ApplicantNotesBindingSource.DataMember = "AppNotes"
    

    Each binding source is in turn assigned to a grid view each to display the entity and related entity data. This works fine as for as displaying data is concerned. However if I try to add a row in related entity (Applicant Notes) via its grid view the row does not get saved. The only way I can make it work is if I modify the LINQ as below which brings all fields from related entity ApplicantNotes and slows down things considerably which I don’t want.

    Dim Query = From a In Context.Applicants Where ... Select a.ApplicantID, a.first_name, a.last_name, a.ApplicantNotes
    

    What can I do to fix data saving issue without having to bring all data from related entity?

    Thanks

    Regards

     




    • Edited by Y a h y a Saturday, December 10, 2011 9:59 PM
    Friday, December 9, 2011 10:31 PM

Answers

All replies