i have 2 plugin preentityupdate , postentityassign. inside update postentityupdate execute assign , invokes postentityassign plugin execution. possible pass shared variables preentityupdate postentityassign? tried unsuccessfully...
i think should through parent context of plugin , try find necessary shared data sharedvariables collections. here example of code:
public new void execute(iserviceprovider serviceprovider) { string shareddatakey = "your key defined here"; bool found = false; ipluginexecutioncontext currentcontext = (ipluginexecutioncontext)serviceprovider.getservice(typeof(ipluginexecutioncontext)); // find shared data among parent contexts ipluginexecutioncontext context = currentcontext; while (context != null) { if (context.sharedvariables.containskey(shareddatakey)) { found = true; break; } context = context.parentcontext; } object shareddata = null; if (found) { // data found in parent context shareddata = context.sharedvariables[shareddatakey]; } else { // data not found in parent context, thereby create new 1 shareddata = new object(); currentcontext.sharedvariables[shareddatakey] = shareddata; } // want 'shareddata' }
something similar used situation described. namely, have 1 pre update entity plugin sometime update related entity leads calling instance of plugin.
Comments
Post a Comment