Connection management

Posts   
 
    
David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 11-Oct-2017 05:20:18   

Is there a way, for reads only, to have LLBLGen open and close a new connection from the Pool?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Oct-2017 08:19:48   

Hi David,

Please elaborate more on what you need and the specifics of your scenario, version, code, etc. ( http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725 ).

If you want to keep a connection open for certain operations, please see Connection Control.

David Elizondo | LLBLGen Support Team
David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 12-Oct-2017 20:05:11   

The scenario is LLBLGen Pro 5.2.3 release 9/20.

Thank you for the link to the connection control under Adapter code generation.

Is there a way to keep to connection open using Self-Servicing?

The issue I am trying to address is similar to the one described under 'connection control' where a fetch command might be taken place under lazy loading while some save commands are incomplete causing the active reader to timeout because its connection closed.

The way I have been addressing this is by carefully controlling when the fetches occur.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 12-Oct-2017 21:05:28   

Is there a way to keep to connection open using Self-Servicing?

That's exclusive to Adapter.

Please check this thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=3793

David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 12-Oct-2017 23:35:46   

How does the Adapter model handle lazy loading?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Oct-2017 08:09:42   

David wrote:

How does the Adapter model handle lazy loading?

There is no lazy-loading. In Adapter you pre-fetch the navigators instead of use y some ideas. For this you should use PrefetchPaths.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Oct-2017 09:55:25   

David wrote:

The scenario is LLBLGen Pro 5.2.3 release 9/20.

Thank you for the link to the connection control under Adapter code generation.

Is there a way to keep to connection open using Self-Servicing?

The issue I am trying to address is similar to the one described under 'connection control' where a fetch command might be taken place under lazy loading while some save commands are incomplete causing the active reader to timeout because its connection closed.

The way I have been addressing this is by carefully controlling when the fetches occur.

Create a Transaction, then do everything inside that Transaction: saves and fetches. They'll use the connection of the Transaction. (so first add the entity/collection to the transaction object, then call the methods which perform the work).

Connection pooling is transparent: it's been handled by the ADO.NET provider.

I'd look into whether you can get rid of the lazy loading and use e.g. prefetch paths. Lazy loading is something that looks nice, but in general will likely cause more problems than it's worth.

Frans Bouma | Lead developer LLBLGen Pro
David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 14-Oct-2017 21:18:47   

Create a Transaction, then do everything inside that Transaction: saves and fetches. They'll use the connection of the Transaction. (so first add the entity/collection to the transaction object, then call the methods which perform the work).

Oh, no doubt I missed adding the collection to the Transaction when fetching. Thanks!

Will this work with Self-Servicing?

When using a Prefetch Path, will the fetch of a related entity, not explicitly added to the transaction, not conflict with the Transaction?

Also, what happens with sub classes in which case the fetch is on the sub class and the inherited entity is not explicitly added to the Transaction?

Last but not least, Cheers to you guys! Thank you for the best support! I have yet to witness a software vendor with such dedication.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Oct-2017 07:12:53   

David wrote:

Will this work with Self-Servicing?

Sure. More info...

David wrote:

When using a Prefetch Path, will the fetch of a related entity, not explicitly added to the transaction, not conflict with the Transaction?

It shouldn't.

David wrote:

Also, what happens with sub classes in which case the fetch is on the sub class and the inherited entity is not explicitly added to the Transaction?

A transaction is not about entities but about the work you execute between the start and the commit. So the queries that will be executed when you are in inheritance include the parent table, so yes, the parent table it's included.

David wrote:

Last but not least, Cheers to you guys! Thank you for the best support! I have yet to witness a software vendor with such dedication.

Thanks David for your feedback and kind words. We hope you continue to enjoy the product and the support. sunglasses

David Elizondo | LLBLGen Support Team