Applies only to version 5.0 and later.
To edit the datamodel of a Relatude Website you must install our Visual Studio plugin:
The datamodel is stored in an xml text file called “content.definition”. To edit the datamodel simply double click the file in Visual Studio and the plugin will open the editor:
When you edit the datamodel and make changes, they are stored in the content.definition file. This is the master file of the datamodel. The code files and database tables are generated from this file.
Everytime you save, the plugin will update the code files and the Relatude runtime will update the database when you start the website. To make a change, simply save in Visual Studio and refresh the site in the browser.
About the code generation
The code generation is by default activated on every save. The code generation is a script and you find it under the script folder inside the editor. If you open it you can see options to set when the generation is activated. There are also options to add your own code generations scripts for building your own testing code, poco objects, view models etc. The script language is python for .Net and you have access to the internal script. Just copy and paste it to make your own script.
About the database update
The Relatude runtime (the WAF.dll running in the website process) will automatically create, rename or delete the tables necessary to make the database fit the datamodel. This allows you to simply publish your code to the server and Relatude will automatically update the database as the website starts. You can also restore and older database backup and Relatude will make sure this database has all the necessary fields to start. (Deleted fields or tables are not actually deleted, but renamed to “xxx___deleted” in case you connect an old datamodel to a newer database)
Working with the definition file
Every time you click save, a definition file is automatically copied to the internal folder “WAF/Files/Definitions” (do not open this file directly). It is this file that is loaded when Relatude starts up. You may operate with different definition files in your projects and call them what you want as long as they end with “.definition”. The last file you save will be the active datamodel. This is useful in case you just want to try out something while keeping a copy of the original definition. Simply copy the definition file and try out your new changes in the copy and open the old one if you want to go back to the original datamodel.
Multiple definition files
It is possible to have multiple definition files in a projects. This is useful in case want to reuse the parts of the datamodel in multiple projects. You create multiple datamodels by creating multiple definition files called "*.templatedefinition" and place them in the folder: "/DefinitionTemplates"