[英]Linq-ToEntities DataSource Assignment Hangs in Winforms

I have a very typical linq-to-entities data binding in WinForms:


myGrid.DataSource = myEntities.entity

When it reaches that line of code it simply hangs. Similar assignment a different entity work fine elsewhere in the code. The database contains no more than 50 lines of data in all entities (it's a new project) so it's not waiting on data.


2 个解决方案


Depending on if it's or windows forms... If it's a client you are trying to databind I would recommend sending the results to a List before assigning it to any datasource.



Interestingly, I may have found the solution. I had an entity we'll call C, which linked entities A and B together as a join table. I decided A and B could be linked directly. Apparently this messed up the internal Linq logic and binding to either A or B then hung. When I removed C the binding to A and B started working.




粤ICP备14056181号  © 2014-2020