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
|
Hi, As new to Lightspeed I wonder how to have true as default value on an entity?! I've tried setting it in the constructor, but then it seems like entities read from db by Lightspeed gets their false values reset. Or I have done some other error for this to happen... Thanks in advance! BR Fredrik |
|
|
Setting a value in the constructor will work for creating a new entity (as in, creating it and adding it to the unit of work for insertion). When you save this entity, if you haven't modified the property, then the value that gets saved to the database will be the default value (true in your case). Thus: // assuming using the designer unitOfWork.Add(new Spline()); will result in True being saved in the IsReticulated column. (If you're not seeing this behaviour, could you provide us with a sample app to reproduce the problem please? Thanks!) When LightSpeed reads an entity from the database, it will populate that entity with the database values. So if the database contains False then the property will be set to false. This is the only possible behaviour really -- we can't interpret False in the database as "leave the default value," or how would we ever be able to load false values from the database? It sounds like you want LightSpeed to leave the property at its default value under certain conditions, but I'm not sure what those conditions should be. Could you clarify or provide an example? Thanks! |
|
|
Thanks for the answer! After some debugging with the assumtion in mind that Lightspeed is not supposed to behave like this, it turns out this was a bug in my code and nothing to do with Lightspeed... BR Fredrik |
|