Generic Collections and Inheritance

Posts   
 
    
Sam avatar
Sam
User
Posts: 95
Joined: 30-Jun-2004
# Posted on: 05-Jul-2006 21:42:27   

I just upgraded to LLBLGen 2.0 (very nice). One thing I am struggling with is inheritance and generic collections. Here is a scenario.

I have a person class and an auto class. Car class has subclasses SportsCar, LuxurySadan ect... Person has generic collections Person.SportsCars, Person.LuxurySadans.

What if I have a form that takes EntityCollection<Car>. MyView.Cars = Person.SportsCar will not work as it is expecting a collection of cars even though SportsCar is a Subclass of car. I have tries MyView.Cars = Person.SportsCar as EntityCollection<Car> to no avail (no built-in conversion) Can anybody help me on this one?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 05-Jul-2006 23:10:13   
Frans Bouma | Lead developer LLBLGen Pro