LiveUpdate lets you use a MDriven Turnkey application as a small model editor, so you can create and evolve classes, attributes, and associations from within the running application.
What LiveUpdate is
LiveUpdate is a merge model that you can use as a starting model or add to an existing model. It contains information about requested model changes. The Turnkey web application interprets that information and performs the requested changes when you use the LiveUpdate functions.
The feature relies heavily on AutoForms. When a model change is applied, AutoForms regenerates the relevant forms so that the new model structure becomes available in the application.
For example, when you add an attribute named Number to an Invoice class, the Invoice seeker and Invoice form can show the new attribute. When you add an InvoiceRow class and associate it with Invoice, the Invoice form can create rows through the association.
What you can change
LiveUpdate provides model-editing actions in the Turnkey application. The demonstrated actions include:
| Change | Result in the model | Example |
|---|---|---|
| Create a class | Adds a new class to the model. | Create Invoice, InvoiceRow, or Customer.
|
| Add an attribute | Adds an attribute of the selected type to a class. | Add a string Number attribute to Invoice when invoice numbers can be alphanumeric.
|
| Add an association | Adds a relationship between two classes, including the role names and multiplicity you specify. | Associate one Invoice with many InvoiceRow objects through InvoiceRows.
|
| Update model elements | Supports the update actions defined by the LiveUpdate model information. | Update an attribute, association, or class through the available LiveUpdate commands. |
Use LiveUpdate to build a small model
Use this workflow to build an invoice model from within a Turnkey application.
- Start a Turnkey application that includes the LiveUpdate merge model.
- Use the LiveUpdate action for adding or changing a class to create
Invoice. - Open the generated Invoice AutoForm and create an Invoice object. At this point it has no business attributes.
- Add an attribute to
InvoicenamedNumber. ChooseStringif values may contain letters as well as digits, such asINV-A12. - Return to the Invoice seeker or form. The regenerated AutoForm now exposes
Number; enter a value such asINV-001and save it. - Create a second class named
InvoiceRow. - Add an
Itemattribute toInvoiceRow. - On
Invoice, add an association whose target class isInvoiceRow. Set the target multiplicity to many, and name the Invoice-to-row end, for example,InvoiceRows. Name the reverse end, for example,Invoice. - Open an Invoice again. The standard AutoForms behavior now lets you add InvoiceRow objects through the association. Create rows with
Itemvalues such asItem 1andItem 2. - Add further attributes when needed. For example, add an image attribute to
InvoiceRow; the regenerated form can then accept an image for each row.
Model changes take effect in the application
LiveUpdate continuously updates the model in the background as you perform the available actions. The resulting model change causes the relevant AutoForms to update, which is why a newly added attribute or association becomes available in the running application.
If the model is also open in MDriven Designer, the model file can be reported as changed. Reload the file to see the classes, attributes, and associations created through LiveUpdate.
Define associations carefully
An association has two ends. Set both the target class and the multiplicity to match the relationship you intend to model.
For an invoice and its rows:
- An Invoice has many InvoiceRows.
- Each InvoiceRow refers back to one Invoice.
For an invoice and its customer:
- Each Invoice refers to one Customer.
- A Customer can have many Invoices.
Check the resulting multiplicities after a change. In the demonstrated scenario, a Customer-to-Invoice relationship was initially created as one-to-one even though the intended relationship was one-to-many.
When to use it
LiveUpdate is useful when you want to bootstrap a small project, explore information and relationships while working in the application, or help less experienced modelers learn by changing the class of the object they are viewing.
You can also add LiveUpdate as a merge module to an existing model so that the existing Turnkey application gains these model-evolution functions. If you later move model work to MDriven Designer, the LiveUpdate classes can be removed when you no longer want to expose this capability.
The available model-editing behavior is defined by the information holders and ViewModels in the LiveUpdate model. Keep access to these functions restricted to the people who should be able to alter the application model.
Deployment context
The walkthrough describes using LiveUpdate with MDrivenServer and a SQL Server database. LiveUpdate changes the model and redeploys it as part of the evolution flow described in the walkthrough. Configure the surrounding hosting environment separately; see Documentation:IIS for IIS-related information.
Download and walkthrough
The LiveUpdate model is distributed as LiveUpdate.modlr.
Watch the LiveUpdate walkthrough for a demonstration of creating Invoice, InvoiceRow, attributes, and associations from the application. The Wednesdays with MDriven session discusses using LiveUpdate to bootstrap a project and adding it to an existing model.
