How extensions work

Completed

You can customize an application by using extensions. An extension enables you to add functionality to existing model elements and source code. With extensions, you can:

  • Create new model elements.
  • Extend existing model elements.
  • Extend source code by using class extensions.
  • Customize business logic. Ways to customize business logic include:
    • Creating event handlers to respond to framework events, such as data events.
    • Creating event handlers to respond to event delegates that are defined by the application.
    • Creating new plug-ins.

Model split

Developing modular code is the driving force behind the model split. Splitting the stack into multiple models provides many benefits, including faster compile time and a greater distinction between partners’ Intellectual property (IPs) in production. The three main models are: Application Platform, Application Foundation, and Application Suite.

Diagram of the models within the modular stack.

Application Platform is the lowest model and contains the lowest level elements that connect with the kernel. Application Object Server (AOS) can be started with only the Application Platform.

Application Foundation sits on top of the Application Platform and contains framework functionalities that are shared by all applications.

Finally, Application Suite sits on top of Application Foundation and contains application-specific elements. Application Platform does not depend on any other models. This implies a direct mapping of the model to an assembly.

Developing in the modular stack allows changes to be made in the Application Suite and compiled without touching the rest of the stack. Only models with new changes need to be compiled, which greatly reduces compile time.

Diagram showing the journey to the extension based customizations.

You can create a model that contains only new model elements, new code, or extensions. This model is compiled into its own separate assembly. These assemblies, along with related metadata and runtime artifacts, can be packaged (as a deployable package file) and deployed on a sandbox or production environment. To start developing with extensions, you need to create a model that will build into its own assembly and can be deployed as a separate package.

Follow these steps to create a new model:

  1. In Visual Studio, go to the Dynamics 365 menu, select Model management > New model.
  2. In the Create model wizard, enter the model information, including the model name and model publisher. Select a layer, enter a model description, and then enter a display name.
  3. After you have specified the model detail, select Next.
  4. On the Select package page, select Create new package. This selection is important because specifies that you will be creating your own package that builds into its own assembly. This step is to extend the application.
  5. Select Next.
  6. Select referenced models. This step is also important. Make sure that you are referencing models of any objects you that you want to extend. You can modify your reference models at any time.
  7. After you have selected models to reference, select Next.
  8. Verify the information on the Summary page, and then select the Create new project and Make this my default model for new projects check boxes.
  9. Select Finish.