HttpAPI + DA + TDALocalDataAdapter


I used ROHttpApiSimpleAuthenticationManager+ROHttpApiDispatcher to do the login security and session to do a HtppAPI +DA project.

It is working correctly for most of the case.

However one of the function I used TDALocalDataAdapter in below code:

  lda := TDALocalDataAdapter.Create(Self.Name);
        cdsAfvs := TDAMemDataTable.Create(nil);
        cdsAfvs.LogicalName := 'Afvs_TBL';
        cdsAfvs.RemoteDataAdapter := lda;
        cdsAfvs.RemoteFetchEnabled := True;
        cdsAfvs.DynamicWhere.Expression := cdsAfvs.DynamicWhere.NewBinaryExpression(
        cdsAfvs.DynamicWhere.NewField('','Afvs_ID_PK'),cdsAfvs.DynamicWhere.NewConstant('-1'), dboEqual);
     // field value assignement;

The above I hit session error. I find in other post advise to

 lGUID := NewGuid;
  lSession := ServerDataModule.SessionManager.CreateSession(lGUID);
  ServerDataModule.SessionManager.ReleaseSession(lSession, true);
  DALocalDataAdapter1.SessionID := lGUID;

Use this way to assign session, will it violate or delete the current active session?
or what is the suugested way to do it?

Actually what is the suggested way to do dataset add change delete at service side with session suppport?

As Currently I defined a function and passed a TRoComplexType and manually process to the dataset update.

Please advise


Can you specify with which service your LDA is communicate? LogicService?
if yes, LoginService should have RequiresSession = False
also you can set lda.ServiceInstance := Self;

I used this way:

  lda := TDALocalDataAdapter.Create(Self.Name);
  lda.SessionID := Session.SessionID;

Then no session error, it is a dataservice required session.
or use your way lda.ServiceInstance := Self; is betteR?


if LDA uses another DataService, this way is preferrable:

  lda := TDALocalDataAdapter.Create('OtherDataService');
  lda.SessionID := Session.SessionID;

in this case, LDA will create a new OtherDataService instance

if LDA connects to self service (i.e. service where is LDA placed) better to use

  lda := TDALocalDataAdapter.Create;
  lda.ServiceInstance := self;

in this case, LDA connects to existing service instance and it shouldn’t create a new instance