/
Creating an Instance of the GenericMongoService

Creating an Instance of the GenericMongoService

The GenericMongoService object provides access to the cached data as well as the Salesforce API. It is used in a similar way to any of the S4S services that inherit from the FuseIT.Sitecore.SalesforceConnector.Services.SalesforceServiceBase abstract class.

The GenericMongoService class has 2 constructors:

GenericMongoService(SalesforceSession session, string objectType)

This constructor requires a SalesforceSession object and a string description of the Salesforce SObject that it is dealing with e.g. "Contact", "Lead", "Account", etc...

//Create an instance of GenericMongoService to work with Saleforce Lead data using a SalesforceSession
GenericMongoService service = new GenericMongoService(SessionTest.GetActiveSession(), Lead.SFType);

GenericMongoService(string objectType)

This constructor requires a string description of theĀ Salesforce SObject that it is dealing with e.g. "Contact", "Lead", "Account", etc. The SalesforceSession is not set in the constructor when you only require read/write to MongoDB and rely on the synchronization for reading and writing to Salesforce.

//Create an instance of GenericMongoService to work with Salesforce Lead data using a SalesforceSession
GenericMongoService service = new GenericMongoService(Lead.SFType);