TypedView, Dynamic Lists and Prefetched paths

Posts   
 
    
Posts: 9
Joined: 16-Jul-2008
# Posted on: 28-Apr-2011 15:31:14   

Hey Guys, a project I have is using the adapter method, and for various displays I need, I went and created Views for them which llblgen brought in as TypedViews. These views have a couple inner joins to return the brand name and category for a product.

I then just read and tried out using Prefetched paths and was able to get the same data I needed.

I've also used dynamic lists a few times to quickly get a resultset i need with having to go do the extra work of adding a view and refreshing and generating the whole llblgen project again.

I was curious what you guys use most of the time. When you need data with some joins it seems like TypedViews is the most work to setup, Dynamic lists are little quicker, and then the Prefetched paths are even simpler to do.

Which do you use the most and which are most effecient. Any idea?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Apr-2011 21:53:53   

This is a question which comes up a lot on the forums - a search should find some useful discussions.

The short answer is (as ever in software development) - "It depends". Mostly it depends on what you need to do with the data once you have retrieved it. If it is only going to be read-only then Typedlists/TypedViews/DynamicViews (they are all essentially the same thing under the hood - a thin wrapper around a DataTable) are the most efficient. They will be quicker to retrieve from the database, and will consume considerably less memory that using entities retrieved with PreFetch paths.

If however, you need to edit the data, then using an entity graph (an entity or set of entities, each with a number of related entities) are really your only choice.

That said, for small datasets (upto say 100 items, but YMMV) the overhead of using entities is barely noticable over that of using the datatable based methods, and I quite often find myself using them rather than having to construct one of the other methods, simply for speed of development.

Matt