Print Page | Close Window

Multi-Tenant Support?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2736
Printed Date: 24-Jan-2026 at 7:50am


Topic: Multi-Tenant Support?
Posted By: bap1
Subject: Multi-Tenant Support?
Date Posted: 01-Jun-2011 at 7:10am
Would some please point me to info on Devforce's mult-tenant features? You mention this in your marketing materials, but I don't see any reference to it in your docs.
We have a large multi-tennant app we are considering moving to Devforce.  We partition the database by customerID key and need to ensure all queries use customerID on the server...based on the user context of the currently logged in user.   I assume we would implement a server side query interceptor?  Can someone provide an example on how to do this?
 
Thanks in advance.



Replies:
Posted By: sbelini
Date Posted: 01-Jun-2011 at 10:30am
Hi bap1,
 
You will find resourceful information in the http://drc.ideablade.com/xwiki/bin/view/Documentation/ - DevForce Resource Center .
Look for the http://drc.ideablade.com/xwiki/bin/view/Documentation/multiple-entityservers - Multiple EntityServers  and http://drc.ideablade.com/xwiki/bin/view/Documentation/create-entitymanager-datasource-extension - Target different databases dynamically topics.
You will also find the http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-data-source-extensions - DataSourceExtensions sample usefull.
 
Silvio.


Posted By: bap1
Date Posted: 01-Jun-2011 at 3:05pm
Thank you!  But I don't want to target multiple databases.  We have 1000s of customers and that's way too many db's to manage.  All data is in same db partitioned by key.  I didn't see anything in your docs related to best practices on this type of implementation.  Any suggestions would be much appreciated!


Posted By: ting
Date Posted: 01-Jun-2011 at 3:34pm
You can enforce tenant partitioning on the server by overriding FilterQuery in the EntityServerQueryInterceptor:
http://drc.ideablade.com/xwiki/bin/view/Documentation/query-server-lifecycle-events#HFilteringthequery - http://drc.ideablade.com/xwiki/bin/view/Documentation/query-server-lifecycle-events#HFilteringthequery

You might also find this page helpful:
http://drc.ideablade.com/xwiki/bin/view/Documentation/filtering-queries-globally - http://drc.ideablade.com/xwiki/bin/view/Documentation/filtering-queries-globally

So, if you have a TenantID column on your tables, you can examine the IPrincipal of the user in the interceptor and apply a .Where(TenantId == userPrincipal.TenantId) clause to the query. This ensures that users only get data related to their TenantId, even if the client-side application developer forgets to apply the restriction (or is hacked to remove the restriction).




Print Page | Close Window