Hi Swanand,
The idea with the Collaboration Providers is that you provision your database the moment that you create it. So that you only need to do this once for every 'peer'.
If you are using a hub-and-spoke model (1 Server and many Clients) then you would make sure the provisioning is done when the database is created (or when the application is moved to production).
If however you want to find out programmatically if the client database is provisioned use code similar to this:
private void EnsureScopeDescription(string scopeName, SqlConnection clientConnection, SqlConnection serverConnection)
{
//create a new scope description and add the appropriate tables to this scope
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope(scopeName, serverConnection);
//class to be used to provision the scope defined above
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();
//determine if this scope already exists on the client and if not go ahead and provision
if (!serverConfig.ScopeExists(scopeName, clientConnection))
{
//note that it is important to call this after the tables have been added to the scope
serverConfig.PopulateFromScopeDescription(scopeDesc);
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
//provision the server
serverConfig.Apply(clientConnection);
}
}