Adapter Collection ASP.NET Databinding

Posts   
 
    
can1
User
Posts: 77
Joined: 16-Sep-2005
# Posted on: 04-Nov-2005 21:15:31   

I am just new to LLBLGen and trying to work out the details.

I am using the extended adapter templates. It appears that the adapter templates return generic EntityCollection objects, not strongly typed collections.

Why do the adapter templates not return strongly typed collections?

How are people using this for ASP.NET databinding? If you create a bound column in an asp.net datagrid, and set the 'Data Field:' property to FieldX, then bind the datagrid to the filled EntityCollection object, will the ASP.NET databind pick up the binding to FieldX, even though the collection is not strongly typed?

Is there a way to easily cast or convert the weakly typed collection to a strongly typed collection, preserving all the IBindingList implementations in the LLBLGen EntityCollection object?

Are people finding this to be a serious problem with adapter templates? or is having a weakly typed collection not an issue? It just seems a little odd for such an incredible tool to return weakly typed collections, having to cast each individual object to the appropriate type before being able to work with it?

Are there plans for version 2.x to return strongly typed collections in the adapter scenario?

Please don't take my questions in a negative manner. I think LLBLGen is awesome, just trying to figure out how to use it properly in my project.

Thanks,

Can1

Paul.Lewis
User
Posts: 147
Joined: 22-Aug-2005
# Posted on: 05-Nov-2005 04:34:37   

Can1,

This thread has some interesting conversation that run's close to the question your asking, but not quite. If nothing else it's an interesting read.

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=834&StartAtMessage=25

The majority of my experience is with the SelfServicing model, so I'm going to defer answering your question more directly.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 05-Nov-2005 12:11:39   

can1 wrote:

I am just new to LLBLGen and trying to work out the details.

I am using the extended adapter templates. It appears that the adapter templates return generic EntityCollection objects, not strongly typed collections.

Why do the adapter templates not return strongly typed collections?

This is mainly because of the overhead in strongly typed collections. For example, if you create a subclass of an entity, say OrderWithTotal, the Orders collection in Customer has to change type, from OrderCollection to OrderWithTotalCollection. This is cumbersome if you work with strongly typed collections.

How are people using this for ASP.NET databinding? If you create a bound column in an asp.net datagrid, and set the 'Data Field:' property to FieldX, then bind the datagrid to the filled EntityCollection object, will the ASP.NET databind pick up the binding to FieldX, even though the collection is not strongly typed?

Yes. You can drag an EntityCollection onto a webform (.NET 1.x) and you'll get a popup which allows you to select the entityfactory to use, for example CustomerEntityfactory. Then you'll see all columns of a customer entity.

Inside EntityCollection, a routine exists which returns to .NET the properties of the object inside the collection. (through the .NET interface ITypedList)

Is there a way to easily cast or convert the weakly typed collection to a strongly typed collection, preserving all the IBindingList implementations in the LLBLGen EntityCollection object?

Only if you derive your strongly typed collection from EntityCollection AND you instantiate a strongly typed collection first, then pass that on to FetchEntityCollection for example, that will work, you can then cast up/downwards.

Are people finding this to be a serious problem with adapter templates? or is having a weakly typed collection not an issue? It just seems a little odd for such an incredible tool to return weakly typed collections, having to cast each individual object to the appropriate type before being able to work with it?

It doesn't seem to be a problem, in fact, it was a request from a lot of people to have a general entitycollection instead of a lot of strongly typed collections.

Are there plans for version 2.x to return strongly typed collections in the adapter scenario?

Yes, for .NET 2.0, a collection which uses generics is planned. Which is of course typed simple_smile

Please don't take my questions in a negative manner. I think LLBLGen is awesome, just trying to figure out how to use it properly in my project.

No problem simple_smile Every feedback is good, and your questions are very reasonable. I hope I've clarified it a bit, if not, feel free to ask more simple_smile

Frans Bouma | Lead developer LLBLGen Pro