LinqToLLBL.ToList() and ObjectId

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 10-Apr-2010 21:33:27   

Platform: LLBLGen 2.6, VS2008, .NET 3.5

Runtime Scenario: Form1: has an Employee combo-box populated from an Employee entity collection's ToList() employeeEC.ToList();

Form2: this form shows details of the Employee entity.

Symptom: 1- at runtime Form1 is opened and then Form2 is opened, 2- change any of the Employee information in Form2 3- the SelectedIndexChanged event of the employee combo-box in Form1 fires!!

if the data-source of the combo-box is set directly using the EntityCollection (without ToList()) then the above does not happen.

The importance of ToList() is that we often use a Linq query as a data-source for a combo-box, and we use the Linq query's ToList() to bind the query result to the combo-box (to allow us to insert into the list an empty element for example). This is leading to Edit forms firing events in combo-boxes (in other opened form)s that are bound to the same Type of entity.

Is this behavior by design? and what design we should follow to avoid this side effect?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Apr-2010 07:09:34   

Could you please show us the code snippet where you are populating the combobox, and where you select the item for edit in form2?

David Elizondo | LLBLGen Support Team