Need to get EntityCollection dynamically

Posts   
 
    
jookyone avatar
jookyone
User
Posts: 104
Joined: 25-Jan-2005
# Posted on: 28-Jan-2005 15:46:45   

Is there any way to get an EntityCollection without explicity specifying the type? For example, I have some classes that handle caching a set of lookup tables for a web app, and I want to be able to just call a method on the caching class like

 EntityCollection collection = CacheManager.GetLookupTable(string key);

Is this possible? I just don't want to have to create separate methods for each EntityCollection that I would need to retrieve.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Jan-2005 16:03:26   

Seflservicing I pressume? Each collection derives from EntityCollectionBase and implements IEntityCollection. You could use one of these for the variable to store the reference in till you pass it on to other routines. Keep in mind that the base class and interface doesn't implement all the typed code which is implemented in the typed classes like GetMulti in various flavors.

Frans Bouma | Lead developer LLBLGen Pro
jookyone avatar
jookyone
User
Posts: 104
Joined: 25-Jan-2005
# Posted on: 28-Jan-2005 16:10:45   

Otis wrote:

Seflservicing I pressume?

Sorry I forgot to mention that..yes I am using SelfServicing code. Not being able to use some of the various flavors of GetMulti is fine, all I want to be able to do is just retrieve all records for a collection, no filtering is necessary. Thanks for the quick response!

jookyone avatar
jookyone
User
Posts: 104
Joined: 25-Jan-2005
# Posted on: 28-Jan-2005 16:41:52   

So would I be using the string key passed in to build the filter for GetMulti to select records on? I want to be able to return a DataTable or DataSet without the cache manager class having to use specific types of entity collections, only the string key that is passed in by the calling class.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Jan-2005 19:14:34   

I'm not quite sure I understand what you want to do. You have a fetched collection of entities, and you want to refetch them, unless they're in the cache? You can use IEntityCollection to call GetMulti(). The getMultiAsDatatable method is a static method so that one isn't available using the interface or baseclass...

Frans Bouma | Lead developer LLBLGen Pro