public PluginStepRegistration(PluginTypeRegistration pluginTypeRegistration, string sdkMessageName, string primaryEntityName, string secondaryEntityName = "", string config = "")
 {
     PluginTypeRegistration = pluginTypeRegistration;
     SdkMessageProcessingStep = new SdkMessageProcessingStep();
     SdkMessageName = sdkMessageName;
     PluginTypeRegistration.PluginType.PropertyChanged += PluginType_PropertyChanged;
     SdkMessageProcessingStep.plugintype_sdkmessageprocessingstep = pluginTypeRegistration.PluginType;
     SdkMessageProcessingStep.plugintypeid_sdkmessageprocessingstep = pluginTypeRegistration.PluginType;
     SdkMessageProcessingStep.Name = primaryEntityName == "none"
         ? $"{sdkMessageName}"
         : $"{sdkMessageName} on {primaryEntityName}";
     PrimaryEntityName = primaryEntityName;
     SecondaryEntityName = secondaryEntityName;
     Config = config;
 }
示例#2
0
        public Guid RegisterStep(SdkMessageProcessingStep step)
        {
            try
            {
                using (var orgService = (OrganizationServiceContext)_ServiceProvider.GetOrganisationService())
                {
                    if (step.plugintype_sdkmessageprocessingstep != null)
                    {
                        if (!orgService.IsAttached(step.plugintype_sdkmessageprocessingstep))
                        {
                            orgService.Attach(step.plugintype_sdkmessageprocessingstep);
                        }

                    }

                    orgService.AddObject(step);
                    orgService.SaveChanges();
                    return step.Id;
                    //  var response = (CreateResponse)orgService.Execute(new CreateRequest() { Target = step });
                    //return response.id;
                }
            }
            catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
            {
                throw;
            }
        }