Database multi-tenancy

   Reading the uses cases we have:
  • You might have a distributed system where you need a central database server with all data for static purposes, but each client will only have access to a subset of that data (multi-tenancy architecture)

    I will have a central database and each  customer  will see only their. own data. 

    Can Echo handle that ?

     Client A,  with a desktop application and 3 mobiles devices  replicating to the central database   

     Client B,  with a desktop application and 5 mobiles devices  replicating to the central database

     So,  I could have a multi-tenancy database using Echo.

     Is it ok ? If so how is the proper way to implement it ?

     Thanks
     

Yes, it's possible. You have to add your own routing logic when calling Route:

http://www.tmssoftware.biz/business/echo/doc/web/routing.html

The key is the anonymous method in the Route parameter:



Echo.Route(
    procedure(Log: TEchoLog; Node: TEchoNode; var Route: boolean)
    begin
      if SameText(Log.EntityClass, 'AppEntities.TEchoInvoice')
        and (Node.Id = 'Client1') then
        Route := false;
    end;
);  


You have to implement your own logic to tell Echo if that specific record should be routed to that specific node.