This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a Sale entity that makes use of a value object called Discount. One of the fields in the Discount value object I want to make an enum. Applying the method for supporting enums described here works fine when the object to which the enum belongs is an entity, but it's not so clear how to apply this to value objects. The problem occurs when setting the Generation attribute of the enum field to 'None'. This has the side effect of removing the field from the value object's constructor's parameter list, which makes newing up instances of the value object a problem. Any ideas? Has enum support in LightSpeed progressed beyond that described in the post linked above? My one thought would be to remove the value object from the designer completely and handle the Discount field on the Sale object manually in code somehow, but a) I'm not sure where to start, and b) it's beneficial to see the Discount value object modelled in the designer for the usual reasons. |
|
|
You can now use enums in the designer. See http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2841&PostID=8894 for details. It's written in terms of entities, but should apply to value objects too. Let us know if you run into any problems. |
|
|
This works a treat! Thanks. Request: can we have enums map to string fields in the DB, writing/reading their string representations instead of ints? This is a nice feature of NHibernate and useful for Human users of the DB. |
|
|
Unfortunately that's a little tricky to do with our current architecture (we don't currently have a way of choosing how to map types on save). It's a nice idea though and I've put it on the wish list -- thanks for the suggestion! |
|