Bundt Programmer's Guide · Bundt Programmer's Interface version

Create an Instance Model

The following example shows how to create an instance model that conforms to a given type model.

To create models, we use the ModelManager static class. This class is a common entry point for many basic operations on models.

To execute this code, you will need a reference to the ModellingEngine library.

using Incipit.Bundt.ModellingEngine;

//create a new type model.
var tmo = ModelManager.CreateTypeModel("TypeTest", VersionInfo.OneZeroZeroZero);

//create a new instance model conforming to tmo.
var imo = ModelManager.CreateInstanceModel(tmo, "InstanceTest", VersionInfo.OneZeroZeroZero);

In line 4, we use the CreateTypeModel static method to create a type model, passing in the model's name and version number.

In line 7, we use a similar method, CreateInstanceModel, passing the previsouly created type model as a parameter. This ensures that the new instance model, imo in the sample code, conmforms to the type model tmo.

Contents distributed under a Creative Commons Attribution 4.0 International License · About · Terms of Use · Contact Us · last updated on 08 October 2020