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'm trying to determine how to implement a Enumeration to Database smallint in LightSpeed. I want to store a smallint in my database and define an enumeration in my project such that when using the lightspeed generated object and I refer to the property that maps to my small in in the database, I get to choose from the enumeration. For example public enum CarColor{ Database Table Cars if ( unitOfWork.Cars.First(c => c.Id == 1).Color == CarColor.black ) { How do you do this in Lightspeed |
|
|
Just declare the entity property as being of the enum type (CarColor). LightSpeed automatically takes care of converting between the database integer and the CLR enum. (We have in the past had a restriction that this only worked with integer columns: I think this is fixed in current nightly builds but I could be wrong.) Note that if you are using the designer, you need to tell the designer about the enum type so that you can select it in the Data Type drop-down. For information about this see http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2841&PostID=8894. |
|