Echo best practise


Setting up my first Echo application.

1) Desktop ("server")
2) Mobile ("clients")

The desktop will prepare all the required data and will only accept a client PULL and PUSH request.

The mobile client will only do a PULL (to get updated data) and PUSH (after a field visit to upload the new data).

a few questions:

1) for the initial install of the mobile app, what is the best practise?

a) to install the whole database as part of the APK deployment (not really practical as data may have changed post APK packaging), and new mobile clients may be install at any time.

b) to install only the bare bones Entities and Echo.Explorer tables? and have the mobile client get all the data via replication???? or via a direct XDATA pull request to populate and bring the client table up to date? and then start the subscription/listener?

2) As a first app, I am not having a multimapping setup and so the ECHO tables and Entities tables are in the same mapping. Can I assume ECHO will only replicate the Entities tables and not the ECHO tables - else i think the mobile client echo tables will have an exact replica of the server echo tables.. which do not make sense.




1) I guess it really depends on the dynamic of your application. Option (b) seems to be better indeed.
2) Why are you mixing them? It's safer to have echo tables in different explorer, if you have echo tables in the same explorer, it will log echo table changes, which will mess everything up.

Yes, I have Echo tables in TEcho.Explorer as in I create the Echo tables with :

DB := TDatabaseManager.Create(Echo.Pool.GetConnection, TEcho.Explorer);

But for my Entities tables:
DB := TDatabaseManager.Create(Echo.Pool.GetConnection);

I did not create a separate Mapping and just use the default (empty)

Will this work okay?

That will work, yes. However, just for the record, if you eventually want strict database validation, the code above will report that some extra tables are in the database. This is because in the first update, it will try to update Echo tables and say the other tables (for entities) should not be there. And in the second update, the opposite will happen: Aurelius will report that undesired Echo tables are in the database. As I said, that is not problem because it's simply a validation, but if you want to avoid that, you can create the TDatabaseManager mixing several TMAppingExplorer objects so that it knows all the tables that should be in database:

  DB := TDatabaseManager.Create(Connection,
    TArray<TMappingExplorer>.Create(TMappingExplorer.Default, TEcho.Explorer)