We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@ReubenBond helped set up this sample that demonstrates a more complex example of creating surrogates in Orleans serialization.
The docs could benefit from including a variant of this example in https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/serialization?pivots=orleans-7-0#surrogates-for-serializing-foreign-types
// Foreign types public record Foo<T>(string Name, T Payload) where T : Bar; public record Bar(Baz Baz, string Something); public record Baz(string Hi); public record BarY(string Content, Baz Baz, string Something) : Bar(Baz, Something); // Surrogates [GenerateSerializer, Immutable] public readonly record struct FooSurrogate<T>(string Name, T Payload) where T : Bar; [GenerateSerializer, Immutable] public readonly record struct BarSurrogate(Baz Baz, string Something); [GenerateSerializer, Immutable] public readonly record struct BazSurrogate(string Hi); [GenerateSerializer, Immutable] public readonly record struct BarYSurrogate(string Content, Baz Baz, string Something); // Converters public sealed class FooConverter<T> : IConverter<Foo<T>, FooSurrogate<T>> where T : Bar { public Foo<T> ConvertFromSurrogate(in FooSurrogate<T> surrogate) => new(surrogate.Name, surrogate.Payload); public FooSurrogate<T> ConvertToSurrogate(in Foo<T> value) => new(value.Name, value.Payload); } public sealed class BarConverter : IConverter<Bar, BarSurrogate> { public Bar ConvertFromSurrogate(in BarSurrogate surrogate) => new(surrogate.Baz, surrogate.Something); public BarSurrogate ConvertToSurrogate(in Bar value) => new (value.Baz, value.Something); } public sealed class BazConverter : IConverter<Baz, BazSurrogate> { public Bar ConvertFromSurrogate(in BazSurrogate surrogate) => new(value.Hi); public BarSurrogate ConvertToSurrogate(in Baz value) => new (value.Hi); } public sealed class BarYConverter : IConverter<BarY, BarYSurrogate> { public BarY ConvertFromSurrogate(in BarYSurrogate surrogate) => new(surrogate.Content, surrogate.Baz, surrogate.Something); public BarYSurrogate ConvertToSurrogate(in BarY value) => new (value.Content, value.Baz, value.Something); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the issue or suggestion
@ReubenBond helped set up this sample that demonstrates a more complex example of creating surrogates in Orleans serialization.
The docs could benefit from including a variant of this example in https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/serialization?pivots=orleans-7-0#surrogates-for-serializing-foreign-types
The text was updated successfully, but these errors were encountered: