This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Today, I found that even if I use a single connection strategy with my unit of works to prevent creating multiples database connections, when some entities must be add to the database, a connection is create internally in the LightSpeed API to fetch a batch of Ids. A couple of years ago, Ivan told me about the single connection strategy and I just love to use it in my winforms application to prevent to much database connection to be created. Is it possible to tells the KeyTable engine to use the same connection used by the unit of work? My goal is to create a single connection at the beginning of the application and I don't want anymore connections. Thank you very much. |
|
|
No unfortunately its not possible to override this. The handling of this is done internally within our data providers with the view that we need to guarantee an independent transaction so the default way of handling this is to start a new connection to avoid getting caught up in any transactions that are in progress on your UOW connection. We are looking at opening up the data provider bits in the future to allow for custom data providers; This would also allow you to override this behaviour and implement your own logic around handling the connection and transaction, but for now this is internal. If you are a source code customer and you dont mind maintaining a custom version of LightSpeed you could make those changes directly yourself - let me know if you are going to go down this route and I can point you in the right direction here :)
|
|
|
Thank you Jeremy. This is exactly what I'm thinking because a couple of months ago, I've already dug into your source code to help me finding ideas to do the same thing of what you said. The strategy pattern could be a nice solution like what you do to makes possible the single connection strategy. |
|