Enumerations in Modlr
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

One weakness we recently rectified was the lack of enumeration definitions inside Modlr. Before, you had to assign an Enumerable type name to an attribute like so:

Enumerations -1.png

Then accept that Modlr treated your attribute of type string and not as an Enumerable:

Enumerations -2 .png

This was simply because the Model was not informed about the Enumeration. In fact, you had to define the Enumeration at some place in the code yourself to get the CodeGen to use it.

Now, you can get up this dialog (add model elements, edit Enumerations):

Enumerations -3.png

Here, declare the enumeration name, values, and code comments (and also the optional integer value).

If the CodeGen checkbox is checked, we will add the Enumeration to your code. The important thing here is that the model has been made more detailed by keeping the knowledge about Enumerations inside the model so that we can use the Enumeration values in constraints, ViewModel validations, etc.

This page was edited 68 days ago on 02/10/2024. What links here