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
|
What is the best strategy for setting the oracle CLIENT_IDENTIFIER environment variable with LightSpeed? With ODP.NET you can set OracleConnection.ClientId property prior to opening a connection. I would like to establish a client identifier at the beginning of each unit of work, Setting some sort of property on the UnitOfWork instance would be ideal. The documentation say each unit of work is a database connection. Does that mean all calls to Oracle within the unit of work are submitted over the same connection? If so, then calling the Oracle procedure dbms_session.set_identifier at the start of each unit of work could be a solution.
|
|
|
Hmm, we don't currently have a means of setting database-specific properties in this way (other than through the connection string). This is something we can look into though. You are correct that each unit of work is a database connection and that all calls to Oracle within the same UOW are submitted over the same connection (and that connection is not shared with other UOWs). Therefore it might be possible to call dbms_session.set_identifier via a ProcedureQuery. The potential issue here is that we currently support only ExecuteScalar (Calculate) and ExecuteReader (Find) queries, so if set_identifier doesn't return a value (i.e. needs to be ExecuteNonQuery) then we would need to add this feature. Let us know if this would be a satisfactory solution and we will look into it. (If this does work, by the way, you can encapsulate it by providing a custom LightSpeedContext.UnitOfWorkFactory, so that you don't need to remember to call the sproc in application code.) |
|
|
I can easily create a procedure that returns a value or a result set. In the future you might want to add support for procs thats return nothing. I'm not quite sure how to implement this UnitOfWorkFactory. Is there a sample? I thought I could just modify the constructor for the autogenerated unit of work class so that it calls my proc. Haven't tried this yet. Thanks
|
|
|
Yep, good point -- if you are using an autogenerated unit of work, adding a custom constructor to that should work, and would be easier than implementing IUnitOfWorkFactory yourself. |
|