locked
Executing Plug In Using Execute or RegisteredEvents RRS feed

  • Question

  • I use the following when writing a plug-in:

    public blah() : base(typeof(blah))
    {           
                base.RegisteredEvents.Add(new Tuple<PipelinePhase, Message, string, Action<LocalPluginContext>>(20, "Update", "account", SomeMethod));
    }

    protected SomeMethod(LocalPluginContext localContext)
    {
     // logic
    }


    I've also saw other people use an Execute method like so:


    public void Execute(IServiceProvider serviceProvider)
    {
     // logic
    }


    What the advantages or disadvantages of each one?  Does it matter?

    Thursday, June 29, 2017 11:58 AM

All replies

  • Hello,

    First part looks like generated with CRM Developer Toolkit. Second (with Execute) is rough implementation of plugin. CRM Developer Toolkit provides couple of additional options but more or less both are equal.


    Dynamics CRM/Business Solutions MVP
    Read My blog

    Thursday, June 29, 2017 4:14 PM
    Moderator