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 - I need to send a list of entities over a WCF service - works fine under normal circumstances. But I am also using the .IncludeDeleted extension to include soft deleted entities. While the deleted entities are getting over the wire as expected - the "DeletedOn" value is null on the other end. Is this by design....? How can I get that value to stay with the entity? |
|
|
Is your model being generated with the DataContract markup included? We do tweak the generation of these read-only fields accordingly if you have System.ServiceModel added as a reference to your model which triggers this.
|
|
|
Yes - all DataContract markup is included and the model works just fine in all other respects - passing objects over the wire and re-hydrating them at the other end. Its just not passing the value for the DeletedOn field. |
|
|
Thanks, Ill need to look into this to see whats occurring and if there is an issue here. If its possible to send through a small repro project in the meantime that would help greatly. Otherwise Ill update the thread once Ive been able to debug this further.
|
|
|
Hi Jeremy - sorry, I haven't been able to mock up a demo project of this - but it's still an issue for us. Have you had a chance to look into it? Thanks. |
|
|
No, sorry I haven't had a chance to set up a repro case here yet. Ill certainly post an update once I have had a chance to look into this though :)
|
|
|
Hi guys I am having a similar issue with the CreatedOn field. It's not been given the System.Runtime.Serialization.DataMember attribute. I am using LS4 at the moment.
|
|
|
Thanks for reporting this. The associated check to generate the DataMember attribute was incorrectly missing from the VB templates which is the cause of the problem. Ive fixed and this will be updated in the next 4.0 and 5.0 nightly builds.
|
|
|
Thanks Jeremy! |
|
|
The CreatedOn doesn't seem to have been implemented. Could you please check this for LS5. I used a recent nightly build. Thanks. |
|
|
The change we made applies to all special fields so CreatedOn is covered by this. Note that the DataMember attribute is applied to the field and not the property - is that what you are checking?
|
|
|
Yes I need to serialise the property I guess. See the original example I posted above comparing the PolicyId property and CreatedOn property. If I return the object via JSON CreatedOn is not serialised and no value present. I realise I could create a custom object and populate it but I was hoping to avoid doing this everywhere. |
|
|
What are you using for your JSON handling? It may be possible to tweak how its serializing that type (or ideally anything which derives from Entity[T] to cater for this. I seem to remember something like this being possible with JSON.NET anyway.. :)
|
|
|
Hi Jeremy, Yes I am using JSON.net. So what are you suggesting I do? Frazer |
|
|
Try using a custom contract resolver within JSON.NET, my thought is to see if you can add a custom property called "CreatedOn" to the contract which targets the _createdOn field. See this thread for a code example: http://www.mindscapehq.com/forums/thread/309498 of implementing one of these in a generic sense. You would then want to try extending whats there already with the custom property.
|
|
|
I am having the same issue with DeletedOn field for an Entity with softDeleted=true not being serialized. I use WCF and the DeletedOn that the http client is receiving is always NULL. Other fields are being serialized/deserialized properly. I use VB.NET and it happens also with the latest Lightspeed product version 5.0.2962 The generated code adds the
Also I can see that there is a
and a
but while some other Properties have the
annotation, the DeletedOn property hasn't. If I add it manually, the code crashes with an Inner Exception: No set method for property 'DeletedOn' in type MyEntity. The class cannot be deserialized. What should I do to get the deletedOn properly serialized and passed to the http client through WCF? Thank you in advance. UPDATE: After regenerating the code I can see
But it doesn't make any difference. DeletedOn is always null |
|