Vixen
02b45cc4
csharp
public struct ShardIdSurrogate

The shadow of ShardId.

Read the guide page for this →

Remarks

This file is how the vocabulary crosses a grain call without the assembly that declares it knowing Orleans exists.

⚠ This file is the price of ADR-017, paid in one place and worth it. Vixen.Live.Abstractions is the assembly a game client transitively references, so it may not carry [GenerateSerializer] — that would put Orleans's own serializer, and its attributes, into an iOS NativeAOT binary for the sake of types that are eleven scalar fields. Orleans's answer to exactly this problem is a surrogate: a shadow struct it does know how to write, and a converter between the two.

So the client's assembly stays a plain library, the cluster's assembly holds the mapping, and neither knows about the other's constraints. The alternative — a second copy of ShardId declared with Orleans attributes — is two types that mean the same thing and drift, which is the failure the whole three-assembly split exists to prevent.

⚠ A type added to the vocabulary and not to this file fails at the first grain call that carries it, not at compile time. ClusterSerializationTests round-trips every one of them through a real Orleans serializer for that reason.

Fields and properties (1)

  • public Guid Value

    The guid.

Used by (1)

  • ShardIdConverterVixen.Live.Cluster