Hi Stephen,
I don't have any issue on connection, since same string is used in connecting to other Cache Objects that were binded to my .Net Studio.
This works perfectly fine.
CacheConnection cacheConnection = EstablishConnection();
CACHEObject.ContainerPosition currentPosition = new CACHEObject.ContainerPosition(cacheConnection);
if (message.currentPosition.locationIdentifier != null)
{
if (message.currentPosition.locationIdentifier != "")
currentPosition.locationIdentifier = message.currentPosition.locationIdentifier;
}
if (message.currentPosition.positionQualifier != null)
{
if (message.currentPosition.positionQualifier != "")
currentPosition.positionQualifier = message.currentPosition.positionQualifier;
}
if (message.currentPosition.positionSlot != null)
{
if (message.currentPosition.positionSlot != "")
currentPosition.positionSlot = message.currentPosition.positionSlot;
}
containerUpdate.currentPosition = currentPosition;
containerUpdate.Save();
containerUpdate.Close();
Where connection string is same with previous message.
private CacheConnection EstablishConnection()
{
CacheConnection cacheConnection = new CacheConnection();
cacheConnection.ConnectionString = "Server=" + Properties.Settings.Default.ServerName +
"; Namespace=" + Properties.Settings.Default.Namespace +
"; Password=" + Properties.Settings.Default.Password +
"; User ID=" + Properties.Settings.Default.Username + ";";
cacheConnection.DynamicMode = true;
cacheConnection.Open();
return cacheConnection;
}
My problem is CacheListOfObjects threw an exception on Cache Disconnected but I find it hard to look for an example of setting the CacheListOfObjects connection. Already browsed the example located at InterSystems\Cache\dev\dotnet\samples.
Regards
Hi Stephen
I did open the connection but the CacheListOfObjects as per my understanding on the error, needs to be open too. But I' am also considering to make my ContainerImco as %SerialObject or %RegisteredObject in case I can't make this work or my CacheListOfObjects to a %Stream.GlobalCharacter.
Thanks for the help! Highly appreciated.
Cheers