问题
CreateRequest Message is named Target,which is of type Entity.But not all Request contain a Target property is of type Entity.
For Example AssociateRequest InputParameter contains Relationship is of type Relationship.
For Example AddItem message will return which property?How should I know there are so many messages in plugin registration tool.how should I know which message has what property it will return.
it was only possible with Debugging?
回答1:
I agree there so many messages, but I had this below file with my, while developing plugin
and I look for the type of Input parameter first
I got this file from http://patrickverbeeten.com/Blog/2008/01/25/CRM-40-Plug-in-message-input-parameters
But I have tried to update this file somewhat for CRM 2011:
Please download file from:
http://tempsend.com/4C08EE4EA9
回答2:
If I understand your question correct you can just do the following:
if (context.InputParameters.Contains("Target")) {
// Do something with Target
}
else if (context.InputParameters.Contains(“Relationship”)) {
// Do something with Relationship
}
If you want to confirm that Target is of Entity (I think it always is in the plugin) then I would think you could just do the following:
if (context.InputParameters["Target"].GetType() == new Entity().GetType()) {
}
来源:https://stackoverflow.com/questions/24545934/how-should-i-know-which-property-comes-under-inputparameters-based-on-message-re