GrainSerializer base types #7597
-
when using e.g. [GenerateSerializer]
public abstract class Person
{
[Id(0)]
public string FirstName { get; set; }
}
[GenerateSerializer]
public class Employee : Person
{
[Id(0)] // ---> should this be 1?
public string Department { get; set; }
} |
Beta Was this translation helpful? Give feedback.
Answered by
ReubenBond
Feb 21, 2022
Replies: 1 comment 1 reply
-
They do not share id ranges, so it's entirely fine to start from zero in each individual type (in fact, it's preferable because smaller numbers take less space). If you have a type like A : B : C, the way it's encoded on the wire is roughly this: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jbockle
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
They do not share id ranges, so it's entirely fine to start from zero in each individual type (in fact, it's preferable because smaller numbers take less space).
If you have a type like A : B : C, the way it's encoded on the wire is roughly this:
<Start> ... C fields ... <EndBase> ... B fields .... <EndBase> ... A fields ... <End>