Windows Forms Databinding

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 14-Sep-2006 23:27:40   

In VS.NET 2005, I created a user control. Added a binding source. Dragged the entity collection from my toolbox to the designer. Was prompted to pick a factory. I selected a factory. Set my combo box data source == to the binding source control. Set the display member and value member of the combo box to fields of the entity.

Now when i click on the Set Entity Factory to use option in the smart tag or the property grid, I get the following error: "Error invoking 'Set EntityFactory to use'. Details: Unable to cast object of type 'Fadv.Samples.BusinessLib.HelperClasses.EntityCollection' to type 'SD.LLBLGen.Pro.OrmSupportClasses.IEntityCollection2'.

Is a bug or ID10T error on my part?

My latest LLBLGen download is from Monday, September 11, 2006, 5:32:02 PM.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 15-Sep-2006 07:47:05   

EntityCollection2 is used in Adapter model, and EntityCollection is used in SelfServicing model.

Select from the toolbox the collection that corresponds to the model that you use.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 15-Sep-2006 09:31:15   

'EntityCollection' is the generated code entity collection so this should work fine. simple_smile

I'll see if I can reproduce it. It's odd though, because the collection derives from a class which implements the interface.

It might be an issue with mismatching runtime library versions: the gui project has a different version of the runtime lib loaded than the generated code. Could you please try to build the solution first and then try again?

Frans Bouma | Lead developer LLBLGen Pro
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 15-Sep-2006 15:34:58   

My solution structure looks like this:

AdventureWorks.Windows (this is my win ui project):
--> project reference to BusinessLib (this is my db generic project) --> file reference to OrmSupportClasses.Net2

BusinessLib (this is my db generic project) --> project reference to BusinessLibDbSpecific (this is the db specific project) --> file reference to OrmSupportClasses.Net2

BusinessLibDbGeneric (this is my db specific project) --> file reference to OrmSupportClasses.Net2 --> file reference to SqlServer.Net2

After taking the advise of Frans, I rebuilt each project 1 at a time, working from bottom to top. Added a new entity collection from the toolbar to the user control designer, and was able to set the factory to use (using both the smart tag, and the link in the property explorer)

So, recompiling seems to have fixed the issue.

Thinking back on the issue, I think that it was happening right after generating the code for the first time and adding the projects to the solution, so I dont think that the code was compiled when I was getting the error.

Long story short, the problem seems to have corrected itself after rebuilding.