I believe for my scenario, everytime I add a new database to my hosted SQL Server for a new group of clients I will add a new entry in the ES DataSources.config on the website assigning an unique DataSourceKey="Database100" along with the connection information pointing to the new database hosted on the internet. When I setup the new group of clients' apps on their local computers, I will dynamically create a New EnterpriseDataSourceItem("Database100", "www.prospecthelper.com/databases", "Database100", ....). Am I correct about this?
Close. I don't have easy access to the help file, but there are two data source keys when using ES. One identifies the data source to ES and is setup in the DataSource.config file on the ES server. This is one the one you'd prompt the user for and store in the registry/wherever. However, there is also one that is used by the BOs of your app. This one should be the same for all the client datasources. I.e. you app is designed to hit a database with a specific schema, abstracted into BOs within the app (E.g. imagine a db has a Customers table, which is abstracted as a CustomersBO in the app). The BO has a key that links it to a datasource setup for the app (your EnterpriseDataSourceItem). Look at the help page again to see which is which. In your example, you are using "Database100" for both, which you don't want (if you did it this way, you'd have to change the key on ALL your BOs based on client...ugly and unnecessary).
Because the EnterpriseDataSourceItem maps its own data source keys to those used by BOs, you can program against one set of BOs, with a set data source key, yet change what database the BO is hitting by simply changing the data source associated with that key (that is what you do in the SetDataSources method will code like DataLayer.DataSources.Add(...)). As I mentioned, in my app, the same BOs can hit an arbitrary dev database using a direct connection via a standard SqlDataSourceItem or it can hit either a test database or the production database via EnterpriseDataSourceItems.
So, I'm gonna assume that the first data source key is the one for the BO and the second one if for ES (check, I could have it backwards), I'd assume you'd have code like this (pseudo code):
Sub SetDataSources
'-- Check registry for existing ES datasource key.
' The GetESKey function would handle prompting and saving key
' if it wasn't already in registry
Dim esKey As String = GetESKey()
'-- Create ES data source item. Note that default BO key of "" is used.
' This not only points to the correct ES server it also maps
' the appropriate ES data source to the data sources used by
' the BOs in the app. I.e. if the BO has a key of "", then ES will use
' the datasource configured with the esKey to connect to the db.
Dim esSource As New EnterpriseDataSourceItem("", "www.prospecthelper.com/databases", esKey, ....)
'-- Add this as a data source for app.
DataLayer.DataSource.Add(esSource)
End Sub