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
|
Is there a way I can set the IDbConnection object in lightspeed rather than setting the ConnectionString. For a test I want to try an in-memory database for VistaDb. Something like this?
IVistaDBDatabase db = VistaDBEngine.Connections.OpenDDA().CreateInMemoryDatabase(null, 1036, true); IDbConnection conn = new VistaDBConnection(db); var context = new LightSpeedContext(); context.Connection = conn; |
|
|
Check this post:
Check also for keywords like "ConnectionStrategy", "SingleConnectionStrategy", etc... in the LightSpeed forum.
This allow you to control which connection that the context will use. You can also control the lifetime of the connection.
I use it in a couple of my WinForms project where a lot of UnitOfWork are created in a short time and I want the context of creating too many connection. |
|
|
Another option which allows you to control which connection gets used while still keeping the default lifetime behaviour is to use the new Interceptor feature (in recent nightly builds). This was primarily designed for wrapping connections for profiling or diagnostic purposes, but could also be used to return a completely custom connection. http://www.mindscapehq.com/blog/index.php/2011/07/28/using-the-asp-net-mvc-mini-profiler-with-lightspeed/ discusses the Interceptor feature -- written in the context of profiling but it should be clear how to apply it to replacing the connection. |
|