Skip to content

Introduction

The Imprevis plugin framework is designed to simplify plugin development for Microsoft Dataverse, enabling you to build, test, and deploy plugins more efficiently. This is done via the Imprevis.Dataverse.Plugins NuGet package which abstracts away common boilerplate code and reduces setup complexity -- allowing you to focus on implementing business logic.

Getting Started

Getting started using the Imprevis plugin framework is very easy.

  1. First, create a new project directory and initialize a new plugin project in it using the Power Platform CLI.

    pac plugin init
    
  2. Open the .csproj is Visual Studio.

  3. Add the Imprevis.Dataverse.Plugins NuGet package.

    dotnet add package Imprevis.Dataverse.Service
    
  4. Remove the PluginBase.cs file as it is not needed.

  5. Update the Plugin1.cs class to use the Plugin base and PluginRunner provided by the Imprevis.Dataverse.Plugins package.

    namespace Sample.Plugins
    {
        using Imprevis.Dataverse.Plugins;
        using Imprevis.Dataverse.Plugins.Extensions;
        using Microsoft.Xrm.Sdk;
    
        public class TestPlugin : Plugin<TestPluginRunner> { }
    
        public class TestPluginRunner : IPluginRunner
        {
            public TestPluginRunner(IPluginExecutionContext context)
            {
                Context = context;
            }
    
            public IPluginExecutionContext Context { get; }
    
            public void Execute()
            {
                // Do something!
            }
        }
    }
    
  6. Build the project, which will generate a .nupkg file.

  7. Register the package in your Dataverse environment using the Plugin Registration Tool.

    pac tool prt
    
  8. That's it! There are a lot of other features included by the framework to improve your life as a developer writing plugins for Microsoft Dataverse.