Prevent generating typed collections - possible?

Posts   
 
    
mpawlica
User
Posts: 5
Joined: 17-May-2010
# Posted on: 17-May-2010 14:57:44   

Hi,

Is it possible to prevent the generator from creating typed collections? I have a fair amount of code generated with version 1.0.2005.1 for .NET 2.0, and all the collections are simply of type EntityCollection. Version 2.6, which I'm using to modify the code is generating typed EntityCollections. Example: Tournament --- 1:n --- Calendar

Old version used to generate a TournamentEntity with a member Calendar of type EntityCollection. New version generates EntityCollection<Calendar>.

I would like to force it to do it the old way. Is it possible? If you ask me why - just out of pure laziness... I could just use the new typed collections (which I prefer personally), but I would have to change a couple of thousands lines of code... and since it's quite well developed, tested and stable, I don't see any reason for doing so.

Sorry if the answer to my question is already somewhere on the forum, but I tried to search for it, unfortunately with no result rage

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 17-May-2010 16:05:11   

Are you generating code from SelfServicing?

As this was listed in the breaking changes sections of the manual:

.NET 2.0: All generated collection classes derive from EntityCollectionBase(of T)....

mpawlica
User
Posts: 5
Joined: 17-May-2010
# Posted on: 19-May-2010 10:03:00   

Hi Walaa and thanks for taking interest in my problem.

No, I am generating code using the Adapter template group, and this is how it was done previously. Is it anyhow linked to generating collections? Sorry, I'm a bit new to LLBLGen...

If I understand the quotation you've provided correctly, there's no way to generate the "old-style" untyped collections... BUT: From what I see in the project's references, the SD.LLBLGen.Pro.ORMSupportClasses.NET20 dll is used everywhere, so I was guessing there was some way of generating a .NET2.0 code with untyped entity collections. Now I'm not sure anymore... Is it possible someone changed the references after generating the code for .NET1.1? Did the 1.0.2005.1 version support .NET 2.0 at all?

I'm getting more and more confused over here, so I'll appreciate any help.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39872
Joined: 17-Aug-2003
# Posted on: 19-May-2010 17:09:39   

It's not possible to do, but you can get around it in your own code, by using IEntityCollection2 instead of 'EntityCollection'. This way, you have a non-generic interface to work with in your own code and don't have to use generics to work with the collections:

IEntityCollection2 orders = myCustomer.Orders;

Frans Bouma | Lead developer LLBLGen Pro