I know how to get an existing connection in LFSO. However, I don't see any documentation or function in RA that will help get an existing connection and output a Session object. Please advise.
Question
Question
How do I convert LFSO LFDatabase object to RA Session object?
asked on August 22, 2014
•
Show version history
1
0
Answer
SELECTED ANSWER
replied on August 22, 2014
You don't need to clone another LFSO connection from the open client's LFSO connection before trying to create the RA session.
You can pass in the serialized connection information returned from the "client.GetEngineConnection()" call into Session.CreateFromSerializedLFConnection().
Dim client As LFClient.Document = System.Runtime.InteropServices.Marshal.GetActiveObject("LFClient.Document") Session sess = Session.CreateFromSerializedLFConnection(client.GetEngineConnection())
0
0
Replies
replied on August 22, 2014
•
Show version history
Try the following:
using LFSO = LFSO91Lib; using RA = Laserfiche.RepositoryAccess; LFSO.LFDatabase db = ...; LFSO.ILFConnection lfconn = db.CurrentConnection; string scs = lfconn.SerializedConnectionString; var raSession = RA.Session.CreateFromSerializedLFConnectionString(scs); // At this point, do not use LFSO with the connection. // Use raSession here and call Session.Close() when done. raSession.Close(); // It's now safe to use LFSO with the session again.
1
0
replied on August 22, 2014
•
Show version history
I am getting the following error on the last line of my code:
System.ArgumentException: Not a serialized LFConnection. Parameter name: serializedConn at Laserfiche.RepositoryAccess.SerializedLFConnection..ctor(Object serializedConn)at Laserfiche.RepositoryAccess.Session.CreateFromSerializedLFConnection(Object serializedConn)
Here is my code:
Dim client As LFClient.Document = TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("LFClient.Document"), LFClient.Document) Dim ClonedConn As LFConnection = New LFConnection() ClonedConn.CloneFromSerializedConnection(client.GetEngineConnection) Dim DB As LFDatabase = ClonedConn.Database Dim lfconn As ILFConnection = DB.CurrentConnection sess = Session.CreateFromSerializedLFConnection(lfconn.SerializedConnectionString)
0
0
SELECTED ANSWER
replied on August 22, 2014
You don't need to clone another LFSO connection from the open client's LFSO connection before trying to create the RA session.
You can pass in the serialized connection information returned from the "client.GetEngineConnection()" call into Session.CreateFromSerializedLFConnection().
Dim client As LFClient.Document = System.Runtime.InteropServices.Marshal.GetActiveObject("LFClient.Document") Session sess = Session.CreateFromSerializedLFConnection(client.GetEngineConnection())
0
0
You are not allowed to follow up in this post.