Ignore a lazy loaded readonly object (NonSerializable)

Ignore a lazy loaded readonly object (NonSerializable)

Old forum URL: forums.lhotka.net/forums/t/12394.aspx


swegele posted on Tuesday, February 25, 2014

CSLA 4.5

On a EditableBusinessObject, I might have a ReadOnly lookup object that is lazy loaded.

My question is this: how do I keep that from getting saved into the graph when it is being serialized with the new PropertyInfo techniques. 

In the old days I would have used a private backing field like so:

<NonSerializable()> mBacking as MyReadOnlyObject.

Thanks,

 

JonnyBee replied on Tuesday, February 25, 2014

Same technique. 

Use private backing fields for Intergraph references and fields that you do NOT want to serialize to client/server and add NonSerialized attribute.  

Copyright (c) Marimer LLC