You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I'm generating the code to handle serialization for BOs. It's not much, but it's repeated code that I could move into the reader and writer contexts. Then, I could change the gen'd code to call these methods in one line, which should hopefully simplify things.
In GeneratorFormatterWriterContext:
publicvoidWrite(IGeneratorSerializablevalue,boolisNotSealed=false){if(value is not null){(var isReferenceDuplicate,var referenceId)=this.GetReference(value);if(isReferenceDuplicate){this.Writer.Write((byte)SerializationState.Duplicate);this.Writer.Write(referenceId);}else{this.Writer.Write((byte)SerializationState.Value);if(isNotSealed){varvalueTypeName= value.GetType().AssemblyQualifiedName!;(var isTypeNameDuplicate,var typeNameId)=this.GetTypeName(valueTypeName);if(isTypeNameDuplicate){this.Writer.Write((byte)SerializationState.Duplicate);this.Writer.Write(typeNameId);}else{this.Writer.Write((byte)SerializationState.Value);this.Writer.Write(valueTypeName);}}
value.SetState(this);}}else{this.Writer.Write((byte)SerializationState.Null);}}
I'm not entirely thrilled with the delegate usage here, but, it does make the call to LoadProperty() optimal. Right now, calling GetReference() always returns an object (because it has to), but then passing that into LoadProperty() as an object causes LoadPropertyByReflection() to be called in CSLA, and that's not idea.
This may allow the methods around the "duplicate" dictionaries in the contexts to be private. Though I need to be careful with that, especially with the deleted list field for lists.
The text was updated successfully, but these errors were encountered:
Right now I'm generating the code to handle serialization for BOs. It's not much, but it's repeated code that I could move into the reader and writer contexts. Then, I could change the gen'd code to call these methods in one line, which should hopefully simplify things.
In
GeneratorFormatterWriterContext
:This would be called like this:
In
GeneratorFormatterReaderContext
:This would be called like this:
I'm not entirely thrilled with the delegate usage here, but, it does make the call to
LoadProperty()
optimal. Right now, callingGetReference()
always returns anobject
(because it has to), but then passing that intoLoadProperty()
as anobject
causesLoadPropertyByReflection()
to be called in CSLA, and that's not idea.This may allow the methods around the "duplicate" dictionaries in the contexts to be
private
. Though I need to be careful with that, especially with the deleted list field for lists.The text was updated successfully, but these errors were encountered: