diff options
author | Jon Skeet <jonskeet@google.com> | 2017-01-16 11:23:32 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2017-01-19 06:46:04 +0000 |
commit | 047575f20cbdee8fb2f88d78a317ffe6133b93e6 (patch) | |
tree | 140117944c03c04c58086d451c09cad7fe2ca919 /csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs | |
parent | eed9951991c6ee7c629b5c4252444c372f7774fd (diff) | |
download | protobuf-047575f20cbdee8fb2f88d78a317ffe6133b93e6.tar.gz protobuf-047575f20cbdee8fb2f88d78a317ffe6133b93e6.tar.bz2 protobuf-047575f20cbdee8fb2f88d78a317ffe6133b93e6.zip |
Support custom options in C#
This consists of:
- Changing the codegen for the fixed set of options protos, to parse unknown fields instead of skipping them
- Add a new CustomOptions type in the C# support library
- Expose CustomOptions properties from the immutable proto wrappers in the support library
Only single-value options are currently supported, and fetching options values requires getting the type right
and knowing the field number. Both of these can be addressed at a later time.
Fixes #2143, at least as a first pass.
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs index cc0a5010..fe5c072c 100644 --- a/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs @@ -78,6 +78,11 @@ namespace Google.Protobuf.Reflection return File.DescriptorPool.FindSymbol<MethodDescriptor>(FullName + "." + name); } + /// <summary> + /// The (possibly empty) set of custom options for this service. + /// </summary> + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal void CrossLink() { foreach (MethodDescriptor method in methods) |