Generate Domain Model Code
This example demonstrates how to generate server-side domain model code based on a client-side survey JSON schema. This functionality is part of a wider use case described in the following help topic: No-code Editor for Domain Models.
To generate domain model code in your application, implement a text parser that converts JSON to the server-side code language you prefer (C# in this demo). View the codegenerator.js
file to see the implementation.
In this demo, you can see the generated domain model code under the Domain Model Code tab in Survey Creator. To implement this UI, create a component that renders a <textarea>
and call the addPluginTab
method to register the component as a plugin.
Domain model property names are converted from form field names, so you need to ensure against unsupported symbols. Handle Survey Creator's onPropertyValidationCustomError
event to validate the names.