Look Up Table Joins 2.0 (Adapter)

Posts   
 
    
Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 17-Aug-2006 11:43:48   

Hi There,

My company just bought your product and I have start just writing some simple tests in Nunit but I'm a bit stuck on this very simple thing:

EntityCollection customers = new EntityCollection(new CustomerEntityFactory()); EntityCollection status = new EntityCollection(new CustomerStatusEntityFactory());

IPrefetchPath2 prefetchPath = new PrefetchPath2((int) EntityType.CustomerEntity); prefetchPath.Add(CustomerEntity.PrefetchPathCustomer);

DataAdapter.FetchEntityCollection(status, null, prefetchPath); DataAdapter.FetchEntityCollection(customers, null);

foreach (CustomerEntity Ce in customers) { Console.WriteLine(Ce.Code + " - " + Ce.Name + " - " + Ce.Status); }

What I’m trying to do is get the customer status via a mapped relationship field. The Ce.Status is the mapped field but it always returns nothing. Any ideas what I’m doing wrong?

On another note, what’s your best practices recommendation for using LLBLGEN pro in a ASP.NET application? From the ASP.net page directly use the Data Classes? Or Should I build a layer between the LLBLGen code and my code?

How much of a performance hit is using self servicing compared to adapter (I know that is a "how long is a piece of string type question")?

Hope my questions aren't too newbish simple_smile

Thanks for your help! -M

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 17-Aug-2006 11:57:18   

Hi There,

Solved the first part with the join:

EntityCollection customers = new EntityCollection(new CustomerEntityFactory());

IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.CustomerEntity); prefetchPath.Add(CustomerEntity.PrefetchPathCustomerStatus);

DataAdapter.FetchEntityCollection(customers, null, prefetchPath);

foreach (CustomerEntity Ce in customers) { Console.WriteLine(Ce.Code + " - " + Ce.Name + " - " + Ce.Status); }

Curious what you have to say about my other questions simple_smile

Thanks M

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 17-Aug-2006 14:09:20   

I would use entities directly as long as they fit.

But what do you mean by performance hit?

Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 18-Aug-2006 03:25:30   

Hi Mihies,

Im trying to decide if the adapter model or the self servicing model would be better to use in my application. One of the major diffrences between the two is that self servicing doesn't perform as fast as the adapter way of doing things I was just curious how much of a diffrence there is.

Thanks M

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 18-Aug-2006 10:18:11   

I don't think that there is a performance difference between the two (somebody might correct me). The major difference is in granularity of control vs ease of use (ss is easer while adater gives you ultimate control). Anyway, I would always opt for adapter way because of the later.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 18-Aug-2006 10:18:25   

Maxus wrote:

Hi Mihies,

Im trying to decide if the adapter model or the self servicing model would be better to use in my application. One of the major diffrences between the two is that self servicing doesn't perform as fast as the adapter way of doing things I was just curious how much of a diffrence there is. Thanks M

What do you mean with 'not as fast' ? Could you elaborate a bit on that please?

Frans Bouma | Lead developer LLBLGen Pro
Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 21-Aug-2006 04:38:01   

Hi Otis,

I was of the understanding that the self servicing arcitecture makes more calls to the Database than the adapter design. for instance if I want to select multliple item that are children of the current item self servicing will automatically get them regardless of if I need them or not. but the adapter will only get them if I use a prefetchpath mechanism. Just wondering what sort of impact that has on the performance? Or does the Lazy loading in the self servicing mechanism negate that?

Thanks M

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Aug-2006 10:09:24   

Maxus wrote:

I was of the understanding that the self servicing arcitecture makes more calls to the Database than the adapter design. for instance if I want to select multliple item that are children of the current item self servicing will automatically get them regardless of if I need them or not. but the adapter will only get them if I use a prefetchpath mechanism. Just wondering what sort of impact that has on the performance? Or does the Lazy loading in the self servicing mechanism negate that?

If you access the properties which trigger lazy loading the related entities one by one, then yes, you have a lot more queries. But you can also use prefetch paths in selfservicing simple_smile and once the data is loaded with a prefetch path, the lazy loading isn't triggered so you don't run into the multi-query issue simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Maxus
User
Posts: 76
Joined: 04-Aug-2006
# Posted on: 23-Aug-2006 12:23:35   

Thanks Otis!

That makes it a bit clearer in my mind. LLBLGen has a fair amount to learn im just starting to get the hang of it simple_smile

Thanks heaps for your help! -M