-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialization for CalendarSystem. #2
Conversation
905fa2c
to
abf6061
Compare
where TBufferWriter : IBufferWriter<byte> | ||
{ | ||
// If the value is null, write it as the null reference. | ||
if (value is null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this instead:
if (ReferenceCodec.TryWriteReferenceField(ref writer, fieldIdDelta, expectedType, value))
{
return;
}
You should delete the MarkValueField
line below, too, since this is a reference typed value.
|
||
public bool IsSupportedType(Type type) | ||
{ | ||
return type == typeof(CalendarSystem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If CalendarSystem
is an abstract class, this should use typeof(CalendarSystem).IsAssignableFrom(type)
instead.
Otherwise, if it's concrete and subtypes are not copyable by this implementation (eg, they are not immutable), then you should delete this and the IGeneralizedCodec
interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually was my assumption as well. This is the definition of CalendarSystem
:
[Immutable]
public sealed class CalendarSystem
{
But, If I remove IGeneralizedCopier
there are multiple tests that fail:
Orleans.Serialization.CodecNotFoundException: Could not find a copier for type NodaTime.CalendarSystem.
public CalendarSystem? ReadValue<TInput>(ref Reader<TInput> reader, Field field) | ||
{ | ||
// This will only be true if the value is null. | ||
if (field.WireType == WireType.Reference) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (field.WireType == WireType.Reference)
{
return ReferenceCodec.ReadReference<CalendarSystem?, TInput>(ref reader, field);
}
Also, I recommend you remove MarkValueField
and use ReferenceCodec.RecordObject
instead.
abf6061
to
8a18327
Compare
943d47e
to
320d17c
Compare
No description provided.