// Retrieve the LFSO connection for a client connection
public static LFDatabase LFSODB()
{
ClientManager lfclient = new ClientManager();
// Find an existing client instance that is logged in to the repository
IEnumerable<ClientInstance> clients = lfclient.GetAllClientInstances();
foreach (ClientInstance _client in clients)
{
IEnumerable<RepositoryConnection> repos = _client.RepositoryConnections;
foreach (RepositoryConnection repo in repos)
{
// Retrieve the serialized connection string and use it to initialize the LFSO connection object
string strSerializedConnection = repo.GetConnectionString();
LFConnection lfsoconn = new LFConnection();
lfsoconn.CloneFromSerializedConnectionString(strSerializedConnection);
LFDatabase lfdb = lfsoconn.Database;
return lfdb;
}
}
return null;
}
Above is the code I am using. I have an opened client and I am logged in. I am using ClientAutomation & LFSO91Lib. I am trying to do this in a service application. It runs perfectly fine when I am running it in a console application. What is going wrong?