You can extend an empty or incomplete MDriven model by merging a reusable .modlr model section into it; this page is for MDriven Designer users who want to add a focused capability without starting from a complete application.
Use merge-in examples when you want to add one capability, such as authentication, password reset, an email queue, or a calendar dimension, to your existing model. If you instead want to apply a model and data as a jump-start to a Turnkey site, use Documentation:Example Gist. For standalone, complete demonstrations, see Documentation:Complete model examples.
Merge a model section
- Download the required
.modlrfile from the relevant example below. - Open the target model in MDriven Designer.
- Save the target model before you merge. This gives you a known version to return to if you need to undo or compare the change.
- In MDriven Designer, choose Open Merge Add and select the downloaded
.modlrfile. - Review the imported class diagrams, classes, ViewModels, actions, and AssetsTK content.
- Save the merged model, then run it in your normal development environment and test the imported capability.
For example, after merging the SVG interaction example, you should see a new diagram and related ViewModels. Run the model and confirm that you can add a box, save it, open the drawing, and move the SVG box before adapting the example to your own UI.
When you create a reusable merge example from an existing model, use Save As for Merge before distributing it. This replaces object identities in the saved copy. Identities have priority during a merge; if no matching identity is found, MDriven then matches by name. Reusing a file with identities that conflict with objects in another model can therefore produce unexpected results.
What MDriven merges
MDriven attempts to combine incoming content with the target model and avoid duplicates. Review the result in MDriven Designer because a merge can add or change several kinds of model content.
| Incoming content | Merge behavior |
|---|---|
| Class with a name already used in the target model | MDriven copies the incoming class content into the existing target class. The incoming class is discarded to avoid a duplicate class. |
| Package with a name already used in the target model | MDriven moves the incoming package content into the existing target package. |
| ViewModel with a name already used in the target model | MDriven skips that incoming ViewModel name. New ViewModels are added. |
| Diagram with a name already used in the target model | MDriven merges the diagrams to avoid duplicates. |
| AssetsTK content | MDriven merges the incoming AssetsTK content into the target model's AssetsTK, adding or updating it. |
Review name collisions deliberately
A matching name does not mean that the two model elements have the same intent. Before merging, compare names in the target model with the package you plan to import. After merging, inspect every class and ViewModel that had a matching name.
For example, if your model already has a ViewModel named ResetPasswordPage, an incoming ViewModel with that name is skipped. You must decide whether your existing ViewModel already provides the required behavior or whether you need to rename and adapt one of the ViewModels before retrying the merge.
Merge-in packages
Authentication: SysUserAuthentication
Merge SysUserAuthentication when your Turnkey system needs the SysSingleton and SysUser classes used for login and authentication. This is an architectural pattern rather than a complete user-management application.
- Download SysUserAuthentication.modlr.
- Merge it into the model that you want to extend.
- Inspect the added classes and diagram.
- Run the application and verify login behavior before building dependent features.
Password reset
The password-reset sample adds password-reset functionality to a model that uses the default ASPNETIdentity package for login. It is intended to be adapted in your model rather than treated as built-in Turnkey functionality.
The package adds:
- A reset-password page that an action can open. This page should have no access groups.
- A server-side ViewModel that runs every 20 seconds and sends reset-instruction emails.
- A page where the user sets a password, including information about expired reset tickets and how to send a new ticket.
After you merge the package:
- Set the PasswordReset package's Default superclass if your model requires one.
- Configure an email server for Turnkey/MDrivenServer. The reset-email ViewModel cannot send messages until email settings are available.
- Create an action that opens the
RestetPasswordPageViewModel. - Test a reset request, delivery of the instruction email, use of the reset page, and the expired-ticket path.
Download PasswordResetTemplate.modlr.
Background work: SysAsyncTicket
SysAsyncTicket is an architectural pattern recognized by MDrivenServer for background work. Use it when work should be performed outside the user interaction that initiated it. For example, use an asynchronous ticket for a task that should continue after the user has submitted an action.
Read AsyncTicket for the pattern and download the SysAsync package from that page before merging it.
Localization and translation
The localization and translation pattern stores translations for text in actions and ViewModels. It also provides Translate OCL operators for data that follows the pattern. Use this package when text must be available in more than one language.
Download Translations.modlr and read Localization and Translation before adapting action text or ViewModels.
Turnkey trace logging: SysTurnkeyTraceLog
Use the SysTurnkeyTraceLog pattern when you need to track user activity in a Turnkey application. Model a class that follows the pattern, then MDrivenTurnkey snapshots information for each navigation change and each action execution that can change data. Every 30 seconds, MDrivenTurnkey spools objects of that class.
The example is available from MDrivenComponents. Review the data captured and access to the resulting log before using it in an application.
Extensions
Charge an end user: Consume and Purchase GetPaid#1
This model extension treats a portal user as a SysConsumer. You can charge the SysConsumer by credit card and consume services from your local model. Download ChargeEndUserViaMDrivenPortalService.modlr and review the imported model before connecting it to your service flow.
PayPal checkout: GetPaid#2
This alternative payment extension integrates PayPal checkout. You need a PayPal account, developer registration, and an app ClientID. After merging, paste the ClientID into the supplied ViewModel and test the checkout flow.
Download PayPalCheckout.modlr.
Runtime theme builder
The theme builder model section lets you set CSS variables that affect UI colors and sizes at runtime. Use it to try settings interactively before incorporating them into your application theme.
Download ThemeBuilder.modlr and see Theme as data.
Outgoing email queue
The outgoing email queue pattern adds queued email handling to the standard base model. Use it when email sending should be queued, monitored, retried after failures, and cleaned up after sending.
It includes:
- A seeker ViewModel for finding queued and sent emails.
- An email-detail view for changing queued emails.
- Two server-side ViewModels: one sends emails and one cleans up sent emails.
- File attachments for outgoing messages.
- Exception handling, error viewing, and retries for failed send attempts.
For example, an administrator can use the seeker view to find failed messages, open the detail view to inspect the error, correct a queued email where appropriate, and allow the sender ViewModel to retry it.
Download OutgoingEmailQueue.modlr. Configure and test email delivery in a non-production environment before relying on the queue.
A seeker view enables you to search for queued or sent emails and an email detail view for changing the queued emails.

- It includes two serverside ViewModels, one that sends the emails and one that cleans up the sent emails.
- It can attach files to outgoing emails.
- It has exception handling, error viewing, and retying failed send attempts.
Calendar dimensions
The calendar model provides classes for linking business data to days, weeks, months, and years. It follows a data-analysis dimension pattern: prepopulate the database with calendar objects so that aggregations for statistics can find the relevant period efficiently.
For example, link an event to a calendar day, then aggregate events by that day's week, month, or year for a diagram or table.
Download CalendarPackage.modlr and read Calendar package.
Complete examples
The following examples are complete demonstrations rather than primarily architectural merge packages. You can merge them to inspect and reuse their modeled solution, or open them separately to study the implementation.
| Example | What it demonstrates | Download |
|---|---|---|
| SVG interaction | SVG objects that react to mouse events, can be moved, and can be saved. | SvgInteractionMoveBoxesAround.modlr |
| Google Maps markers | Showing a marker, tracking map settings, and moving the marker. Production use requires your own Google API key. | GoogleMapWithMarkers.modlr |
| Trello-like board | Cards that users move between lists, with card interaction. | TrelloLikeBoard.modlr |
| TinyMCE markup editor | Rich HTML text editing. | HtmlEditor.modlr |
| Interactive Gantt chart | Displaying and interacting with data on a timeline. | GanttChartInteractive.modlr |
See Documentation:Complete model examples for the descriptions of these examples.
Introduction to Examples and Merge
Examples you can merge into your empty or incomplete model include: Examples you can merge into your empty or incomplete model to gain some functionality include:

or/and :

SysUserAuthentication - important architectural pattern
This example adds the SysSingleton and SysUser classes needed to enable login and authentication in Turnkey systems.

Download SysUserAuthentication. Once downloaded, click "open merge add" from the model you want to extend.
Password Reset Sample - Architectural Pattern
If you use the default package for login, the ASPNETIdentity package, this package will extend your model with the following:
- A reset password page that you can create an action to go to. This page should not have any access groups.
- A server-side ViewModel that runs every 20 seconds and sends emails with reset instructions to your users. Remember to set the Turnkey/MDrivenServer's email server settings.
- A page for the user to set the password. This page also has information for the user about expired reset tickets and sending new tickets in those circumstances.
You import this template and then you:
- Set the PasswordReset package's "Default superclass" if you want that.
- Make sure you have an email server set up.
- Create an action that opens the "RestetPasswordPage" ViewModel.
Download the model file here: PasswordResetTemplate.modlr

Localization and Translation - Architectural Pattern
MDriven systems can adhere to a model pattern and use that to store translations to all texts in actions and ViewModels. There are also OCL operators (Translate) that work on data according to this pattern. Read more here.

SysTurnkeyTraceLog
If you need to track what users are up to in your Turnkey app, add a class following this pattern:

For every navigation (change of view) or action (action language execution resulting in potential data change), information will be snapshotted, and every 30 seconds, MDrivenTurnkey will spool out objects of the above class.
Customer implementation example: This is how it was used in one customer case:

This example is available at: https://github.com/supportMDriven/MDrivenComponents.git
Consume and Purchase GetPaid#1
This model extends your system with the ability to charge the end-user for services you provide. The user will be treated as a SysConsumer in the portal. You can charge the SysConsumer with a Credit card and let the SysConsumer consume your services with a simple call in your local model. Download ChargeEndUserViaMDrivenPortalService.modlr:

PayPal - Checkout GetPaid#2
As an alternative method to get paid by users, integrate PayPal. You will need a PayPal account and register as a developer. Once this is done, register your app and get a ClientID. Paste this ClientID into this ViewModel and you are all set. PayPalCheckout.modlr


Theme Builder - Build Themes in Runtime
You can easily set CSS variables to influence the colors and sizes of the UI. To try different settings out in runtime, you can merge this model section:


Calendar Model for Linking Things to Dates, Weeks, Months, and Years
It follows a common pattern with dimensions from data analysis. By prepopulating the database with days, months, years, weeks, etc, you can easily (and efficiently) find data to present in a diagram or table.

See also
- Documentation:Example Gist
- Documentation:Complete model examples
- Documentation:Model
- Documentation:Practical expressions to get insights into your model content
- Documentation:OCLOperators allInstances
Reference for constructing links to files in documentation. This is how the link should be formed: https://www.mediawiki.org/wiki/Help:Linking_to_files
