FuelSDK-CSharp icon indicating copy to clipboard operation
FuelSDK-CSharp copied to clipboard

What Lifetime/Lifestyle should ETClient be?

Open TraGicCode opened this issue 3 years ago • 2 comments

The documentation is not clear as to what the lifetime/lifestyle should be configured for the ETClient. If i were to guess it's really trying to say singleton. Without singleton then caching and refreshing of tokens would be pretty useless feature. Can someone confirm this?

https://github.com/salesforce-marketingcloud/FuelSDK-CSharp/blob/aebf1e071723a6686ac567bc2c25bbdab14d54a0/README.md#example-request

The ETClient class takes care of many of the required steps when accessing Salesforce Marketing Cloud's API, including retrieving appropriate access tokens, handling token state for managing refresh, and determining the appropriate endpoints for API requests. In order to leverage the advantages this class provides, use a single instance of this class for an entire session. Do not instantiate a new ETClient object for each request made.

Thanks!

TraGicCode avatar Apr 28 '21 19:04 TraGicCode

Also, if you have a single application that is responsible for sending emails for multiple business units will creating 2 singletons ETClient Singletons be problematic?

TraGicCode avatar Jun 13 '21 03:06 TraGicCode

Cc @gdu-sf

TraGicCode avatar Jun 16 '21 00:06 TraGicCode