You are viewing limited content. For full access, please sign in.

Question

Question

What is the best approach to handle a Session in a Custom Activity?

SDK
asked on November 29, 2016

Hi everyone,

I’m trying to create custom activity for Workflow and I want to use RepositoryAccess 9.2 to validate a LoginName and if it is a valid account I gets its identifier for others validations.

So I have to use a Session like this: 

Dim acctRef As New AccountReference(loginName, MySession)

I noticed in the documentation for creating a custom activity, the code contains a method that creates a session. I tried one with LFSO and the other just with the ActivityExecutionContext

Using wrapper As ConnectionWrapper = executionContext.OpenConnection90()

                Dim MyDatabase As ILFDatabase = CType(wrapper.Database, ILFDatabase)
                Dim MySession As Session = Laserfiche.RepositoryAccess.Session.CreateFromSerializedLFConnection(MyDatabase.CurrentConnection.SerializedConnection)

                Dim loginName As String = Me.ResolveTokensInText(executionContext, Me.LoginName)
                Dim acctRef As New AccountReference(loginName, MySession)
                acctRef.ToSecurityIdentifier()
...

End Using


or  


Dim auten As AuthenticationInfo = executionContext.GetAuthenticationInfo()

Using MySession As Session = Session.Create(auten.Server, auten.Repository)

           Dim loginName As String = Me.ResolveTokensInText(executionContext, Me.LoginName)
           Dim acctRef As New AccountReference(loginName, MySession)
           acctRef.ToSecurityIdentifier()
            ...
  
End Using

Is this correct, don't impact in the Global Sessions or should we use a different method that uses the current existing session?

Thanks for your support

Regards.

0 0

Replies

replied on November 30, 2016

Hi,

I achieved to identify the exact versions of Repository Access Library that we are using in the different servers, so I tried to use the session with the code below and works fine. I think is the better way to handle the session.

Using wrapper As ConnectionWrapper = executionContext.OpenConnectionRA()
                Dim MySession As Session = CType(wrapper.Connection, Session)

                Dim loginName As String = Me.ResolveTokensInText(executionContext, Me.DomainLoginName)
                Dim acctRef As New AccountReference(loginName, MySession)

End Using

Thanks and if somebody has another idea, let me know.

Regards.

0 0
replied on November 30, 2016

That seems to be fine. Though, i have to ask what you meant by "identify the exact versions of Repository Access Library that we are using in the different servers ". RepositoryAccess is backwards compatible, so you don't have to match its version to the server version.

Keep in mind that these connections will be counted against the concurrent session limit for that user and don't forget to log them off when you're done.

0 0
replied on November 30, 2016

Thanks for the reply Miruna.

Then the 3 ways to implement the Session will open a new Session. I will keep it in mind.

About the versions. I have a development machine that has Avante LF 10 and VS2015, so I installed the SDK 9.2 and copied and pasted the templates of Workflow 9 from another Dev Server with Rio LF 9 to use the project templates.

I developed a custom activity supporting RA9.2 and I implemented it to Dev Server Rio.

First I found this error:

Method not found: 'Laserfiche.Custom.Activities.ConnectionWrapper 
Laserfiche.Custom.Activities.CustomActivityExtensions.OpenConnectionRA92(System.Workflow.ComponentModel.ActivityExecutionContext)'. 

So I tried with other ways to get the session like my first code of Session.

After other tests I tried to change OpenConnectionRA92() with OpenConnectionRA() and convert the session:

Dim MySession As Session = CType(wrapper.Connection, Session)

but I found another error:

[A]Laserfiche.RepositoryAccess.Session 
cannot be cast to [B]Laserfiche.RepositoryAccess.Session. 

Type A originates from 'Laserfiche.RepositoryAccess, 
Version=8.2.0.0, Culture=neutral, PublicKeyToken=36c16aaa' i
n the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Laserfiche.RepositoryAccess\8.2.0.0__3f98b3eaee6c16a6\Laserfiche.RepositoryAccess.dll'. 

Type B originates from 'Laserfiche.RepositoryAccess, 
Version=9.1.0.0, Culture=neutral, PublicKeyToken=36c16aaa' 
in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Laserfiche.RepositoryAccess\v4.0_9.1.0.0__3f98b3eaee6c16a6
\Laserfiche.RepositoryAccess.dll'.

Finally I added to my VS Project the reference for RA8.2 and implemented it again in Dev Server Rio with the last code of Session where I converted it and works fine.

So my first conclusion is that both servers need to have the same SDK Runtime installed, but although both have it, the Dev Server Rio still use the RA8.2 and it is not compatible with my develop reference RA9.1 or RA9.2.

0 0
replied on November 30, 2016

RA 8.2 is not supported in Workflow.  The message above says it can only find RA9.1. So it looks like you tried to add an activity with RA9.2 to WF 9.1.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.