If you are using Gigya's Data Store (DS) to store user-related data as well as Sitefinity 9 as a CMS, the DS Sync module adds the ability to pull data from Gigya's Data Store and map it into the user account database in Sitefinity. Synchronization between Sitefinity and Gigya's Data Store (DS) is provided through an optional, separate package that can be installed on top of the main Gigya core package for Sitefinity.
Customers who only use Gigya's account storage, and do not use the Gigya Data Store service, do not have to install this additional module.
Note that DS is supported by Gigya CMS module version 3.2.1 and up.
Installation and Implementation
To implement DS sync follow these steps:
1. Install DS Sync Module
The Data Store sync module is installed via NuGet. To install the package:
Right-click References on your web project and select Manage NuGet Packages.
Make sure the package source is nuget.org and type "gigya" in the search box.
Select the DS package that corresponds to your Sitefinity version as shown in the table above and click Install.
Build your project in Visual Studio.
If your core Gigya module has not yet been updated to match the selected Sitefinity version, it will update automatically.
2. Configure DS Settings
In a multi-site environment, you can configure settings per site or globally. By default, all sites inherit the global settings, so you can configure the global settings, then set different configurations for individual sites. The global settings are accessed from the Basic Settings menu on the left-hand side.
Data Extraction Method
In the Gigya DS Settings tab available on the left-hand menu, configure how to retrieve DS data from Gigya, whether search or get. The default is search.
- Search: This calls ds.search and is the recommended option when using more than one OID or DS type (table).
- Get: This calls ds.get and is the recommended option when using one OID and one DS type (table).
Map Gigya DS fields to the corresponding fields in Sitefinity.
- Open the Gigya DS Settings tab from the menu on the left-hand side.
- Under Gigya DS Field, specify the DS field to be mapped, in the following format: ds.type.field. If the field was assigned a suffix in the Gigya DS, denoting the field type (e.g., _i to denote an integer field), you should also add the suffix to the gigyaName field mapping. Examples:
- Under Gigya DS OID, enter the Data Store Object.
- Enter the Sitefinity field.
- When you've finished adding fields, click 'Save changes'. Note that empty or partially filled mapping definitions will generate an error, so remove unnecessary lines by clicking 'Remove'.
For performance reasons, the Gigya DS settings are cached in memory for a default of 60 minutes. This can be changed by adding an AppSetting with Gigya.DS.CacheMins as the key, e.g.:
When settings are updated through Sitefinity, the cached settings are cleared from memory. This is fine in a single server environment but won’t work for a load balanced environment as each server has its own cache. To clear the cache on the other servers you could republish the settings there or restart the app pool.
Manually Retrieving Gigya DS Data
DS data can be manually retrieved using the Gigya.Module.DS.Helpers.GigyaDsHelper class.
Below is an example of how you could retrieve DS data manually. If you want to use your own settings this can be done by passing your own settings models into the GigyaDsHelper constructor.
Using Hooks to Manipulate Data Before Mapping into Sitefinity
After the DS fields have been retrieved, an event is fired which can be subscribed to in order to manipulate the account info object before the fields are mapped to Sitefinity. The following code sample demonstrates how to do this. Usually this code would be added to Global.asax.cs. As this event is fired after DS data is merged with getAccountInfo data, the event will only be fired when user data is being synced with Sitefinity after login, register and edit profile events.
You can also subscribe to an event which is fired after DS data is retrieved manually as well as when retrieved to be merged with getAccountInfo. This is useful if you always want to run custom code after DS data is retrieved, regardless of whether it has been invoked manually or by the DS module.
The events described in the core module can also be used to manipulate data. See Gigya Connector for Sitefinity 9.
Here is a sample:
- Turn on Debug mode in the Settings page and check the debug logs.
- If a Gigya field is not being saved to Sitefinity check the field mappings on the Settings page:
- Make sure field names are correct
- Make sure fields are of the same type (e.g., don’t map a string Gigya DS field to a numerical Sitefinity field).
The package can be uninstalled in the standard NuGet way:
- Open the project in Visual Studio and right-click on References.
- Click Manage Nuget Packages.
- Select the package to uninstall.
- Click Uninstall.