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
Replace Guid serialization #292
Comments
Not currently, no.
…On 2 Aug 2017 6:21 a.m., "Rush Frisby" ***@***.***> wrote:
To work around protobuf-net's handling of Guids which other languages
don't know how to work with I've ended up doing this a lot:
[DataContract]public class TestResult
{
public Guid Id { get; set; }
[DataMember(Order = 1)]
private string IdValue
{
get
{
return Id.ToString();
}
set
{
Id = Guid.Parse(value);
}
}
}
This can get messy if Guids are used a lot and I'd like to use a surrogate
instead:
RuntimeTypeModel.Default.Add(typeof(Guid), true).SetSurrogate(typeof(GuidSurrogate));
however, I get this runtime exception:
System.ArgumentException: 'Data of this type has inbuilt behaviour, and
cannot be added to a model in this way: System.Guid'
Is there any way to get around this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#292>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABDsKfaYB60r8IuQ4QdTioS9SorXg86ks5sUAdRgaJpZM4OqnLZ>
.
|
Not sure if this will help (for others also as I realise this post comes a little late) but there are some ideas here floating around here: |
For today: this topic is actually addressed by Compatibility Level: https://protobuf-net.github.io/protobuf-net/compatibilitylevel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To work around protobuf-net's handling of Guids which other languages don't know about I've ended up doing this a lot:
This can get messy if Guids are used a lot so I'd like to use a surrogate instead:
however, I get this runtime exception:
Is there any way to get around this?
The text was updated successfully, but these errors were encountered: