🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
MDrivenFramework
This page was created by Hans.karlsen on 2025-02-17. Last edited by Wikiadmin on 2026-07-29.

MDriven Framework lets .NET developers build applications from an information model in MDriven Designer and extend the generated domain classes with strongly typed C# code.

What MDriven Framework provides

MDriven Framework is a model-driven framework for .NET. You define the domain in MDriven Designer, generate code from that model, and compile the result as a standard .NET solution. The model is the source from which MDriven derives domain classes, persistence mapping, and database schema information.

For example, you can add a Customer class and an Order class to the model, generate code, and then add C# behavior to the generated types. Put hand-written behavior in separate partial-class files so that it remains separate from generated code.

MDriven Framework also includes optional runtime capabilities such as domain-layer undo and redo, versioning for selected classes, and declarative actions. It is UI-agnostic at its core and has declarative ViewModel engines for technologies including WPF and Windows Forms. For a product overview and framework capabilities, see Documentation:MDriven Framework – a Model driven framework.

Prerequisites

Before creating a project, install the following:

  • Visual Studio 2022.
  • MDriven Framework, downloaded from mdriven.net/downloads.
  • The MDriven Visual Studio extension (VSIX) included with the download.

Install the Visual Studio extension

  1. Download MDriven Framework from mdriven.net/downloads.
  2. Run the downloaded VSIX installer.
  3. Install the extension for Visual Studio 2022.
  4. Restart Visual Studio if the installer requests it.

The extension installs the MDriven project templates that you use to create a starter solution.

Create a solution from the MDriven template

  1. Start Visual Studio 2022.
  2. Create a new project by using the MDriven Solution Template.
  3. Choose a location and create the solution.
  4. Open the model in MDriven Designer.

The template creates multiple projects. They are examples and starting points rather than a requirement to use every project in the final application. Keep the projects that match the client technologies and target frameworks you need; you can create another template solution later when you need a clean reference starting point.

Restore and update the runtime packages

The template obtains the MDriven runtime components through NuGet. After creating the solution, refresh the template's NuGet packages so that the solution uses the current package versions available to it.

For example, if you want to run the WPF project targeting .NET Framework 4.7.2, restore and update the packages before building it. Do the same for any other template project that you intend to use.

Package availability differs between current and legacy packages. See NuGet packages for package guidance.

Build and run the starter targets

The template is intended to let you work with one model across several client targets. After package restoration, you can build and run these starter applications against the same model:

Client technology Target framework Intended outcome
WPF .NET Framework 4.7.2 Build and run the WPF starter application.
Windows Forms .NET Framework 4.7.2 Build and run the Windows Forms starter application.
WPF .NET 8 Build and run the .NET 8 WPF starter application.
Windows Forms .NET 8 Build and run the .NET 8 Windows Forms starter application.
  1. Select the client project you want to run as the startup project.
  2. Build the solution.
  3. Resolve package-restore or compilation errors before proceeding.
  4. Run the startup project.

Make your first model change

Use this workflow to confirm that the model, generated code, and application are connected:

  1. Open the model in MDriven Designer.
  2. Add a class, such as Customer.
  3. Add an attribute, such as Name.
  4. Generate code from the updated model.
  5. Build the solution.
  6. Run one of the client projects and verify that it uses the updated model.

When you change the model, MDriven Framework can update derived code and evolve the database schema while preserving existing data. Read Database Evolution before applying model changes to an established database.

Extend generated classes without changing generated files

Generated domain classes are partial classes. Add your own logic in a separate partial-class file rather than editing generated code.

For example, if the model generates a Customer class, place custom C# logic in a separate file that declares the same partial class:

public partial class Customer
{
    public string DisplayName()
    {
        return Name;
    }
}

This keeps your custom code separate when you generate code again. For the broader framework workflow and extension topics, start at Documentation:Framework.

Learn the core concepts

MDriven Framework work commonly involves these concepts:

  • MDriven Designer: the tool in which you define the UML-based domain model.
  • ViewModel: a declarative description of data and interaction used by MDriven UI technologies.
  • OCL: the expression language used for model expressions, derivations, and rules.
  • CodeDress: custom C# behavior that dresses the model-generated classes.
  • MDrivenServer: the server-side product used in relevant deployment and application scenarios.

See also