I updated my RO SDK to the latest version (10.0.0.1521) but my code does not build anymore
For a local linq adapter I use the code below, however the static member data GlobalSessionManager does not exist anymore. The documentation on your website still describes this field.
What is the correct way of creating a local DA data adapter now?
public static LinqLocalDataAdapter prepareSyncMasterLocalLinqAdapter()
{
var sesmgr= RemObjects.SDK.Server.SessionManager.GlobalSessionManager;
if (sesmgr == null)
return null;
Guid guid = Guid.NewGuid();
var ses = sesmgr.GetSession(guid);
var dataAdapter = new LinqLocalDataAdapter("SyncMasterService", guid);
sesmgr.ReleaseSession(ses);
return dataAdapter;
}
Note:
I tried
var dataAdapter = new LinqLocalDataAdapter(“SyncMasterService”, Guid.NewGuid());
but when I call ToDABindingList on a GetTable result I get a null pointer exception
Introduced a static class RemObjects.SDK.Server.Engine. This class provides access to global SessionManager, EventSinkManager and MessageQueue instances.
Corresponding static properties were removed:
This code works for me as expected for LinqLocalDataAdapter:
var lda = new LinqLocalDataAdapter("DataService", Guid.NewGuid());
var result = lda.GetTable<Orders>().Where(o => o.OrderDate < DateTime.Today.AddDays(-10)).Select(o => o).ToDABindingList();
MessageBox.Show($"Result: {result.Count}");
Could you show stacktrace of the NRE you mentioned (or, even better, to create a testcase where this issue can be reproduced)?
Could you check that the SyncMasterService service is not marked as Abstract ?
(logged an issue to raise proper exception when an Abstract service is accessed via LocalDataAdapter)
FYI: I tried the RemObjects.SDK.Server.Engine.SessionManager apporach but this is also not possible because this manager value is null.
Is this expected?
Is there anything I can do now?
Should I wait for the next version?
After debugging more I see the RemObjects.SDK.Server.Engine.SessionManager is initially null but has a value when the server is fully started. So I can solve this issue via my code.
However I have a license issue now.
Initially I got ‘No valid license has been found for BaseDataAbtractService’
After copying the licenses.licx file to the csproj that contains this class this was fixed but using DA still fails.
I now get ‘No valid license has been found for the type RemObjects.DataAbstract.RemoteCommand’ when fetching data via GetTable.
I already added extra classes to all my licenses.licx but the error remains.
As expected. After all setting this property is one of the server startup steps.
Probably it did mention BaseDataAdapter, as BaseDataAbtractService does not perform license checks.
Please check that licenses.licx has its Build Action set to Embedded Resource.
Is this code executed server-side or client-side?
BaseDataAbstractService is a class created by me which is derived from DataAbstractService
The problem is gone now. Not sure why. I performed full builds.
It would be nice to know what should go in theses files. Especially since they are not always automatically created/updated (when using dlls?)
There is a known issue in Visual Studio (yes, it is a Visual Studio bug) that will apparently never be fixed at all:
if there is a licenses.licx file and one have updated versions of referenced libraries - there might be license check errors because licenses.licx might not be reprocessed even after Rebuild or Clean / Build commands. The only workaround is either to delete obj and bin folders manually or to change something in the licenses.licx file. Note: All above apllies only to .NET Framework projects, not .NET Core or .NET 5+ projects.
The minimal licenses.licx content for Data Abstract server app is