locked
Different database locations for multi tenant RRS feed

  • Question

  • I need advice the scenario i want to create, i am building a SaaS app, i am planning on using a Shared Database, Shared Schema approach where the TennanID column associates every record with the appropriate tenant inside a SQL AZURE database.  

    On the Scaling department i will use a  Tenant-Based Horizontal Partitioning, and that implies that i will create additional databases to spread my client base and potentially move clients around.

    One way of accomplishing this is that i will have an index database with the TennantID and the Database location for that tennant.

    Having fetched that information i would need to ether:

    1: manage to somehow change the ServerConnectionString on DefaultScopeSyncService.

       public static void InitializeService
    
    (Microsoft.Synchronization.Services.ISyncServiceConfiguration config) {
    
     config.ServerConnectionString = "Data Source=database0001.database.windows.net;Initial Catalog=mediptest;User 
    ID=foo;Password=bar;Trusted_Connection=False;";
    <br/>
    
    programmatically depending on what the client is sending  or

    2: somehow inside the same WebRole have another incarnation of DefaultScopeSyncService.svc  something like Server2ScopeSyncService.svc ... Server3ScopeSyncService.svc (For 3 databases) that are all an exact copy of the DefaultScopeSyncService.svc but points to another database location.  
    Then on the client, decide what service to connect based on the index database, that in this case would have returned the correct service for the tenant to connect.

    This kind of works but it demands that in the client i have all the proxy classes for every service that i can potentialy use ie:

    DefaultScopeEntities.cs

    DefaultScopeOfflineContext.cs

    Server2ScopeEntities.cs

    Server2ScopeOfflineContext.cs

    Server3ScopeEntities.cs

    Server3ScopeOfflineContext.cs


    This seems strange and unecessery, is there a batter way to do this? maybe option number 1 (no clue how to do it though!) any insight is greatly appreciated!  
    Tuesday, February 15, 2011 6:40 AM

Answers

  • Hi TestingSync,

    Unfortunately #1 this is a limitation of the 4.0 CTP. You would need to have separate services in separate websites (as the service configuration is static). We will fix these issues in a future release.

    For #2, you may be able to just use one set of files as long as you host the services in separate websites and keep the namespaces the same in all the services.


    SDE, Sync Framework - http://www.giyer.com
    Wednesday, February 16, 2011 10:18 PM

All replies

  • Hi TestingSync,

    Unfortunately #1 this is a limitation of the 4.0 CTP. You would need to have separate services in separate websites (as the service configuration is static). We will fix these issues in a future release.

    For #2, you may be able to just use one set of files as long as you host the services in separate websites and keep the namespaces the same in all the services.


    SDE, Sync Framework - http://www.giyer.com
    Wednesday, February 16, 2011 10:18 PM
  • Hello,

    any news on this? I would like to go for #1 too.

    Wednesday, July 20, 2011 7:34 AM
  • am not sure its going to get fixed, but the Sync v4 CTP code is supposed to be released end of August (see: http://social.msdn.microsoft.com/Forums/en-US/synclab/thread/2c6f1ab8-fed4-4c43-9a55-93002a9a8e02)

    with the code in hand, you can easily switch connections.

    Wednesday, July 20, 2011 7:48 AM