Hi,
i read already a lot about the context.Depth property and i understood it completly, but my problem is this comment: "now exit - if the derived plug-in has incorrectly registered overlapping event registrations" in a newly created plugin by visual
studio.
Context.Depth and this exit here handle different cases of problems which can occur right?
And the other question is why i need this exit here, beccause when the plugin iterates over the list of registrated steps like "create" there is a FirstOrDefault(). So the plugin takes always the first action even if there are more actions registrated.
As you see in the code stub below.
I don't understand this comment and what it is for!
The following code i copied out of the auto generated project for microsoft crm when you create a new plugin with visual studio 2012.
// Iterate over all of the expected registered events to ensure that the plugin
// has been invoked by an expected event
// For any given plug-in event at an instance in time, we would expect at most 1 result to match.
Action<LocalPluginContext> entityAction =
(from a in this.RegisteredEvents
where (
a.Item1 == localcontext.PluginExecutionContext.Stage &&
a.Item2 == localcontext.PluginExecutionContext.MessageName &&
(string.IsNullOrWhiteSpace(a.Item3) ? true : a.Item3 == localcontext.PluginExecutionContext.PrimaryEntityName)
)
select a.Item4).FirstOrDefault();
Kind Regards
Markus