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
|
Hello All, I am encountering an issue of using UDT,I created an entity contains an UDT field,which is an inatance of class as following,
and I am using field converter to serialize the UDT field to xml, save a string into database,interesting thing is that ,data is only inserted when entity is new,but nerver be updated when property items changed( say,changing a item in list),does anyone have idea? Any help will be appreciate. C.F. |
|
|
Can you provide some detail about how you have specified this in your model file? Ideally just paste in the code for the entity and the UDT. LightSpeed will only know to update the entity if a property is marked as changed (which is usually via the Set() call in the property setter) so presumably this is not being triggered because your UDT properties will not be making this type of call.
|
|
|
Hello Jeremy, Thanks a lot for your reply,the code of UDT property is like ,
and UDT is like
Can you let me know if the code is not enough for you investigate this issue. C.F. |
|
|
Thanks for the extra detail. Presumably you are performing an operation such as adding an item to the Items list in the Order object when you are making an update, rather than re-assigning the MyOrder value with a new instance. This will not be able to indicate to LightSpeed that the property (MyOrder) has changed as a result of your update. We will only know the field has changed if you actually assigned a new instance to the MyOrder property. Currently we dont really have a way of handling this, but Ive added in a facility (for now) which will be available in the next nightly build which you can use to manually indicate that you are making a change. Here is an example of how you will be able to use it:
You will need to define a method on your PO object (add this to a partial class definition) which will look something like this:
This will allow LightSpeed to know that you are changing the MyOrder property. You can then go ahead and manipulate this as you would like. I will have a think about how we want to handle this going forward, but for now you can use this to overcome the current issue you are having.
|
|
|
Thanks Jeremy, I think there might be a way in Lightspeed to compare object to determine if a object changed,we tried cloning the target object before save,that works,it seems only new instance will be determined by Lightspeed as you mentioned. Charles |
|
|
When you assign an object to the property the Set() call performs an equality check between the existing value and the new value, so that is why your re-assignment with a cloned object will work. Have you grabbed the latest nightly and had a look at applying the change mentioned above?
|
|
|
This is great. I had a field that was the S3 bucket for a user. When I updated the file in the S3 bucket, I previously had no way to make LightSpeed bump the UpdatedOn date to match. Now I can just ping the field. |
|
|
Excellent, the method is included in the updated assembly ,it is working. Charles |
|