Hello !
Investigating the possibility of passing data between methods I've come across this pattern of using a context object that implements System.IDisposable.
See this post: https://community.dynamics.com/365/financeandoperations/b/mfp/posts/extensible-x-method-signatures for reference.
Basically, it's a singleton that get disposed in order to avoid stale data, and It's type-safe.
This pattern it's used in in many places as a method to avoid adding extra parameters to an existing method.
For example the classes like this are use to define this kind of singleton.:
ContextPackingSlipTrans_IT,
ProjValEmplProjSetupParameters,
RetailTerminalTableContext,
As I said, mainly they are used to avoid adding extra parameter to existing methods but also a convenient way to pass data between methods in case of implementing extension classes (see ContextPackingSlipTrans_IT). Some of those objects are instantiated from forms.
ContextPackingSlipTrans_IT It's using the user seesionId to address the concurrency issue, but others do not have something like this.
The question is how this work with concurrency? If multiple users trigger the same functionality at the same time, wouldn't that mean they will steal each others data because of this singleton object?
Thank you.