Thursday, April 22, 2010

Enumerations in Modlr

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


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


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

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


And in here you 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.


Anonymous Anonymous said...

Not available in eco 5 version Which version and build has this?



April 23, 2010 at 6:14 PM  
Blogger Hans Karlsen said...

This was added recently so it went into Eco6. Eco6 is stable and we will publish an offical build for VS2008 and VS2010 asap; until then you can get it from the dailybuilds (VS2008)

April 24, 2010 at 12:07 PM  
Anonymous Anonymous said...

Hi Hans,
I got the latest buid but how to open this "EditEnums" window?

Thank you!

April 28, 2010 at 12:16 PM  
Blogger Hans Karlsen said...

Right click on Package or class, add model elements, Edit enumerations

April 29, 2010 at 8:50 AM  
Anonymous Anonymous said...

guest00: thank you, but the form is empty...

April 29, 2010 at 12:21 PM  
Blogger Hans Karlsen said...

This form was created with a viewmodel and I created it in VS2010, what I forgot was to update the VS2008 project to embed the viewmodel file as a resource...
My bad, Sorry!
Fixed next build.

April 29, 2010 at 4:01 PM  
Anonymous Anonymous said...

Hi Hans,
I confirm that the form for enums is ok in the buld
but you did something with viewmodel it is not possible to add the combo-column.
Should I use mantis for the daily builds?

Thank you,

April 30, 2010 at 2:25 PM  
Blogger Hans Karlsen said...

Thanks Alex,
What did I do? Tested and the combocolumns seems to work for me... Sure you have n..0 association to set?
If you want to create a combobox yourself, just add "other column" two times, say that one is pick list for the other. Yes you can use mantis.

April 30, 2010 at 2:42 PM  
Blogger David Compton said...

So with this new feature do we still have to add enumeration to persistence mapper in the same way i.e. via SqlDatabaseConfig | PersistenceMappers?

May 10, 2010 at 12:51 AM  
Blogger Hans Karlsen said...

The standard way to store the enum is with their string value. That has not changed.

If you are fine with this standard you need not to anything more to declare an enum than what is explained in the post above

May 10, 2010 at 3:03 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Contact Us | Terms of Use | Privacy Statement © 2009 CapableObjects