Relation between session GUID and instances of services

Hi to all,

In Remoting SDK is possible create private instances of services per session GUID.

Example:
One client connect to server, make login and create new session for your GUID(xxx.xxx.xxx), in this session will create instances of services that will only by the used for user that have the GUID (xxx.xxx.xxx).

Thanks

yes, it is possible
e.g. you can manually create server instance inside your service method like

  xxx := TMyService.Create(nil);
  try
     xxx.MyMethod;
  finally
     xxx.free;
  end; 

Good, this way it is possible to separate a class instance for each GUID?

in my example, TMyService will be created for each session if default class factory was used

Hi,

I’m next to achieve the expected result, but this with a behavior that in my case it would not be ideal. after the User be logged into your session every call made to service a new instance is created.

It is not possible to use the same instance of service until the user’s session is disconnected without that ever again be created?

you can use non-standard class factory that changes this behavior.
pls review the Class Factories article and the Class Factories sample

Hi,

My problem is that if I connect the same customer in a service TRODataSnapModule type is created a new instance as another client, therefore the provider dynamically created by other service is like in another session and can not access the provider that it was created by the call.
It is possible to get around this? Making each client (session) has your instance of TRODataSnapModule?

why you can’t use TROPerClientClassFactory?

I’m using TROPerClientClassFactory in Service and DataSnapModule. Through service I create the provider and call the RegisterProvider method. With the DataSnap connection I try to access the provider registered at this time is created a new instance of DataSnapModule.

can you create a simple testcase that reproduces this issue, pls?
you can attach it here or drop email to support@

The e-mail is support at remobjects.com ?

yes.
by other hand, you can send PM to support here

@EvgenyK

This is a example:

RO.zip (218.0 KB)

Edit:
I’ve updated your testcase: testcase.zip (61.2 KB).
now it works as expected

Hello,
I implemented as the test case and it worked. When I use the ClassFactory the PerClient type the instance of the service will only be destroyed when the timeout is reached or I can destroy it before? if yes, how ?

SessionManager.DeleteSession(Session.SessionID,False)