Article Original Creation Date: 2007-10-09
Version(s)
Neo.2d
Problem
How to implement Multi-Tenancy
Solution
Multi-Tenant Configuration
Multi-Tenancy is configured in the web.config file. To enable multi-tenancy the value of the SingleTenantFolder key in the AppSettings section must be set to an empty string and the MultiTenantRepository key in the connectionStrings section must point to a Tenant Database (see next section).
Also added the CacheObjectExpiration key in the AppSettings section. This value is used to specify the sliding inactivity expiration time, in minutes, for the CRMSystem and ScreenSet cached objects.
Multi-Tenant Database
The MutliTenant Database is used to map a Company Login ID to a Working Folder. Use the scripts below to create and populate the tenant DB.
create table SYSTEMTENANT
(
COMPANY_PK VARCHAR (40) PRIMARY KEY NOT NULL ,
COMPANY_ID NVARCHAR(80) UNIQUE NOT NULL ,
COMPANY_NAME NVARCHAR(255),
WORKING_DIR NVARCHAR(255),
COMPANY_LOOKUP_ID NVARCHAR(255),
DATABASE_SERVER NVARCHAR(255),
DATABASE_NAME NVARCHAR(255),
CONNECTION_STRING NVARCHAR(255),
CREATE_STAMP DATETIME ,
UPDATE_STAMP DATETIME ,
DEVTESTPRODFLAG VARCHAR (12),
IS_ENABLED INTEGER
);
-- insert template
--insert into systemtenant(COMPANY_PK,COMPANY_ID,COMPANY_NAME,WORKING_DIR,COMPANY_LOOKUP_ID,DATABASE_SERVER,DATABASE_NAME,CONNECTION_STRING,CREATE_STAMP,UPDATE_STAMP,DEVTESTPRODFLAG,IS_ENABLED)
--values ('1','ProdClone','Satellite Clone','C:\Databases\ProdClone2d',null,'win2003x64','iAveProdcloneEdit','',getDate(),getDate(),'Prod',1);
Login Page Changes
In Multi-Tenant Mode the login page will contains a "Company Id" input field. This field allows the user to specify the company they belong to which is used to find the correct Working Directory. The company id is matched against COMPANY_ID field in the tenant database using a case insensitive search.
Branding
Added ability to display a custom image on a per company basis. This is accomplished by supplying the NavLogo.png file under the Branding folder in the working directory (you will need to manually create the Branding folder the 1st time). This file should be approximately 130x130 pixels. If this file exists then the image will be displayed on the user's NavBar.
Web Service Changes
Added a companyID parameter to the Login method. For Multi-Tenant configurations, this value specifies the company the user belongs to. This value is ignored for Single Tenant configurations.
Additional Info
KEYWORDS | multi-tenant multi-tenancy |
FUNCTION_TYPE | OTHER |
PROGRAM | INSTALL |
PRODUCT_TYPE | CRM On Demand |
INTERNAL_KB | Y |