aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/build.csproj4
-rw-r--r--protos/extest/unittest_generic_services.proto29
-rw-r--r--protos/google/protobuf/csharp_options.proto4
-rw-r--r--src/ProtoGen/ServiceInterfaceGenerator.cs16
-rw-r--r--src/ProtocolBuffers.Test/DescriptorsTest.cs30
-rw-r--r--src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj1
-rw-r--r--src/ProtocolBuffers.Test/ServiceTest.cs34
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs88
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs250
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs88
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs110
-rw-r--r--src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs39
-rw-r--r--src/ProtocolBuffers2008.sln2
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs110
14 files changed, 373 insertions, 432 deletions
diff --git a/build/build.csproj b/build/build.csproj
index efc69c14..b6edf2b9 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -38,6 +38,7 @@
<Protos Include="$(ProtosDirectory)\extest\unittest_extras_full.proto" />
<Protos Include="$(ProtosDirectory)\extest\unittest_extras_lite.proto" />
+ <Protos Include="$(ProtosDirectory)\extest\unittest_generic_services.proto" />
<Protos Include="$(ProtosDirectory)\extest\unittest_rpc_interop.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\descriptor.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\csharp_options.proto" />
@@ -101,6 +102,9 @@
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestRpcInterop.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
</GeneratedSource>
+ <GeneratedSource Include="$(BuildTempDirectory)\UnitTestGenericServices.cs">
+ <TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
+ </GeneratedSource>
<!-- Lite unit test -->
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestExtrasFullProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>
diff --git a/protos/extest/unittest_generic_services.proto b/protos/extest/unittest_generic_services.proto
new file mode 100644
index 00000000..3fe2e8eb
--- /dev/null
+++ b/protos/extest/unittest_generic_services.proto
@@ -0,0 +1,29 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+import "google/protobuf/unittest.proto";
+import "google/protobuf/unittest_custom_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGenericServices";
+
+option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+package protobuf_unittest;
+
+option optimize_for = SPEED;
+
+service TestGenericService {
+ rpc Foo(FooRequest) returns (FooResponse);
+ rpc Bar(BarRequest) returns (BarResponse);
+}
+
+service TestGenericServiceWithCustomOptions {
+ option (service_opt1) = -9876543210;
+
+ rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) {
+ option (method_opt1) = METHODOPT1_VAL2;
+ }
+}
+
diff --git a/protos/google/protobuf/csharp_options.proto b/protos/google/protobuf/csharp_options.proto
index d9fe04e1..33a7b03d 100644
--- a/protos/google/protobuf/csharp_options.proto
+++ b/protos/google/protobuf/csharp_options.proto
@@ -58,10 +58,12 @@ message CSharpFileOptions {
// Controls how services are generated, GENERIC is the deprecated original implementation
// INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and
// implementations using the included Windows RPC interop libarary.
- optional CSharpServiceType service_generator_type = 225 [default = GENERIC];
+ optional CSharpServiceType service_generator_type = 225 [default = NONE];
}
enum CSharpServiceType {
+ // Services are ignored by the generator
+ NONE = 0;
// Generates the original Java generic service implementations
GENERIC = 1;
// Generates an interface for the service and nothing else
diff --git a/src/ProtoGen/ServiceInterfaceGenerator.cs b/src/ProtoGen/ServiceInterfaceGenerator.cs
index 4aa8ffaa..019df4c8 100644
--- a/src/ProtoGen/ServiceInterfaceGenerator.cs
+++ b/src/ProtoGen/ServiceInterfaceGenerator.cs
@@ -47,6 +47,9 @@ namespace Google.ProtocolBuffers.ProtoGen {
: base(descriptor) {
svcType = descriptor.File.CSharpOptions.ServiceGeneratorType;
switch (svcType) {
+ case CSharpServiceType.NONE:
+ _generator = new NoServicesGenerator(descriptor);
+ break;
case CSharpServiceType.GENERIC:
_generator = new GenericServiceGenerator(descriptor);
break;
@@ -63,6 +66,19 @@ namespace Google.ProtocolBuffers.ProtoGen {
public void Generate(TextGenerator writer) {
_generator.Generate(writer);
}
+
+ class NoServicesGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
+
+ public NoServicesGenerator(ServiceDescriptor descriptor)
+ : base(descriptor) {
+ }
+ public virtual void Generate(TextGenerator writer) {
+ writer.WriteLine("/*");
+ writer.WriteLine("* Service generation is now disabled by default, use the following option to enable:");
+ writer.WriteLine("* option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;");
+ writer.WriteLine("*/");
+ }
+ }
class ServiceInterfaceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {
diff --git a/src/ProtocolBuffers.Test/DescriptorsTest.cs b/src/ProtocolBuffers.Test/DescriptorsTest.cs
index c5223f9f..f3c03cd6 100644
--- a/src/ProtocolBuffers.Test/DescriptorsTest.cs
+++ b/src/ProtocolBuffers.Test/DescriptorsTest.cs
@@ -75,13 +75,13 @@ namespace Google.ProtocolBuffers {
Assert.AreEqual("ImportEnum", UnitTestImportProtoFile.Descriptor.EnumTypes[0].Name);
for (int i = 0; i < file.EnumTypes.Count; i++) {
Assert.AreEqual(i, file.EnumTypes[i].Index);
- }
-
- ServiceDescriptor service = TestService.Descriptor;
- Assert.AreEqual(service, file.Services[0]);
- Assert.AreEqual(service, file.FindTypeByName<ServiceDescriptor>("TestService"));
- Assert.IsNull(file.FindTypeByName<ServiceDescriptor>("NoSuchType"));
- Assert.IsNull(file.FindTypeByName<ServiceDescriptor>("protobuf_unittest.TestService"));
+ }
+
+ ServiceDescriptor service = TestGenericService.Descriptor;
+ Assert.AreEqual(service, UnitTestGenericServices.Descriptor.Services[0]);
+ Assert.AreEqual(service, UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("TestGenericService"));
+ Assert.IsNull(UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("NoSuchType"));
+ Assert.IsNull(UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("protobuf_unittest.TestGenericService"));
Assert.AreEqual(0, UnitTestImportProtoFile.Descriptor.Services.Count);
for (int i = 0; i < file.Services.Count; i++) {
Assert.AreEqual(i, file.Services[i].Index);
@@ -261,11 +261,11 @@ namespace Google.ProtocolBuffers {
[Test]
public void ServiceDescriptor() {
- ServiceDescriptor service = TestService.Descriptor;
-
- Assert.AreEqual("TestService", service.Name);
- Assert.AreEqual("protobuf_unittest.TestService", service.FullName);
- Assert.AreEqual(UnitTestProtoFile.Descriptor, service.File);
+ ServiceDescriptor service = TestGenericService.Descriptor;
+
+ Assert.AreEqual("TestGenericService", service.Name);
+ Assert.AreEqual("protobuf_unittest.TestGenericService", service.FullName);
+ Assert.AreEqual(UnitTestGenericServices.Descriptor, service.File);
Assert.AreEqual(2, service.Methods.Count);
@@ -310,9 +310,9 @@ namespace Google.ProtocolBuffers {
enumType.getOptions().hasExtension(UnittestCustomOptions.enumOpt1));
Assert.AreEqual(Integer.valueOf(-789),
enumType.getOptions().getExtension(UnittestCustomOptions.enumOpt1));
- */
-
- ServiceDescriptor service = TestServiceWithCustomOptions.Descriptor;
+ */
+
+ ServiceDescriptor service = TestGenericServiceWithCustomOptions.Descriptor;
Assert.IsTrue(service.Options.HasExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1));
Assert.AreEqual(-9876543210L, service.Options.GetExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1));
diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
index f72bcf87..83a598d3 100644
--- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
+++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
@@ -92,6 +92,7 @@
<Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" />
<Compile Include="TestProtos\UnitTestEmbedOptimizeForProtoFile.cs" />
<Compile Include="TestProtos\UnitTestEmptyProtoFile.cs" />
+ <Compile Include="TestProtos\UnitTestGenericServices.cs" />
<Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportProtoFile.cs" />
<Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" />
diff --git a/src/ProtocolBuffers.Test/ServiceTest.cs b/src/ProtocolBuffers.Test/ServiceTest.cs
index f6f7c747..579c4582 100644
--- a/src/ProtocolBuffers.Test/ServiceTest.cs
+++ b/src/ProtocolBuffers.Test/ServiceTest.cs
@@ -50,12 +50,12 @@ namespace Google.ProtocolBuffers {
delegate void Action<T1, T2>(T1 t1, T2 t2);
- private static readonly MethodDescriptor FooDescriptor = TestService.Descriptor.Methods[0];
- private static readonly MethodDescriptor BarDescriptor = TestService.Descriptor.Methods[1];
+ private static readonly MethodDescriptor FooDescriptor = TestGenericService.Descriptor.Methods[0];
+ private static readonly MethodDescriptor BarDescriptor = TestGenericService.Descriptor.Methods[1];
[Test]
public void GetRequestPrototype() {
- TestService service = new TestServiceImpl();
+ TestGenericService service = new TestServiceImpl();
Assert.AreSame(service.GetRequestPrototype(FooDescriptor), FooRequest.DefaultInstance);
Assert.AreSame(service.GetRequestPrototype(BarDescriptor), BarRequest.DefaultInstance);
@@ -63,7 +63,7 @@ namespace Google.ProtocolBuffers {
[Test]
public void GetResponsePrototype() {
- TestService service = new TestServiceImpl();
+ TestGenericService service = new TestServiceImpl();
Assert.AreSame(service.GetResponsePrototype(FooDescriptor), FooResponse.DefaultInstance);
Assert.AreSame(service.GetResponsePrototype(BarDescriptor), BarResponse.DefaultInstance);
@@ -71,14 +71,14 @@ namespace Google.ProtocolBuffers {
[Test]
public void CallMethodFoo() {
- MockRepository mocks = new MockRepository();
- FooRequest fooRequest = FooRequest.CreateBuilder().Build();
+ MockRepository mocks = new MockRepository();
+ FooRequest fooRequest = FooRequest.CreateBuilder().Build();
FooResponse fooResponse = FooResponse.CreateBuilder().Build();
IRpcController controller = mocks.StrictMock<IRpcController>();
bool fooCalled = false;
- TestService service = new TestServiceImpl((request, responseAction) => {
+ TestGenericService service = new TestServiceImpl((request, responseAction) => {
Assert.AreSame(fooRequest, request);
fooCalled = true;
responseAction(fooResponse);
@@ -115,8 +115,8 @@ namespace Google.ProtocolBuffers {
FooRequest fooRequest = FooRequest.CreateBuilder().Build();
MockRepository mocks = new MockRepository();
IRpcChannel mockChannel = mocks.StrictMock<IRpcChannel>();
- IRpcController mockController = mocks.StrictMock<IRpcController>();
- TestService service = TestService.CreateStub(mockChannel);
+ IRpcController mockController = mocks.StrictMock<IRpcController>();
+ TestGenericService service = TestGenericService.CreateStub(mockChannel);
Action<FooResponse> doneHandler = mocks.StrictMock<Action<FooResponse>>();
using (mocks.Record()) {
@@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers {
.IgnoreArguments()
.Constraints(Is.Same(FooDescriptor), Is.Same(mockController), Is.Same(fooRequest),
Is.Same(FooResponse.DefaultInstance), Is.Anything())
- .Do((CallFooDelegate) ((p1, p2, p3, response, done) => done(response)));
+ .Do((CallFooDelegate) ((p1, p2, p3, response, done) => done(response)));
doneHandler(FooResponse.DefaultInstance);
}
@@ -137,14 +137,14 @@ namespace Google.ProtocolBuffers {
[Test]
public void CallMethodBar() {
- MockRepository mocks = new MockRepository();
- BarRequest barRequest = BarRequest.CreateBuilder().Build();
+ MockRepository mocks = new MockRepository();
+ BarRequest barRequest = BarRequest.CreateBuilder().Build();
BarResponse barResponse = BarResponse.CreateBuilder().Build();
IRpcController controller = mocks.StrictMock<IRpcController>();
bool barCalled = false;
- TestService service = new TestServiceImpl(null, (request, responseAction) => {
+ TestGenericService service = new TestServiceImpl(null, (request, responseAction) => {
Assert.AreSame(barRequest, request);
barCalled = true;
responseAction(barResponse);
@@ -168,15 +168,15 @@ namespace Google.ProtocolBuffers {
}
- class TestServiceImpl : TestService {
+ class TestServiceImpl : TestGenericService {
private readonly Action<FooRequest, Action<FooResponse>> fooHandler;
private readonly Action<BarRequest, Action<BarResponse>> barHandler;
private readonly IRpcController expectedController;
internal TestServiceImpl() {
- }
-
- internal TestServiceImpl(Action<FooRequest, Action<FooResponse>> fooHandler,
+ }
+
+ internal TestServiceImpl(Action<FooRequest, Action<FooResponse>> fooHandler,
Action<BarRequest, Action<BarResponse>> barHandler,
IRpcController expectedController) {
this.fooHandler = fooHandler;
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
index 1d2039c6..4fca38db 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
@@ -3957,90 +3957,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion
#region Services
- public abstract class TestServiceWithCustomOptions : pb::IService {
- public abstract void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse> done);
-
- public static pbd::ServiceDescriptor Descriptor {
- get { return UnitTestCustomOptionsProtoFile.Descriptor.Services[0]; }
- }
- public pbd::ServiceDescriptor DescriptorForType {
- get { return Descriptor; }
- }
-
- public void CallMethod(
- pbd::MethodDescriptor method,
- pb::IRpcController controller,
- pb::IMessage request,
- global::System.Action<pb::IMessage> done) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.CallMethod() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse>(
- done));
- return;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetRequestPrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetResponsePrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public static Stub CreateStub(pb::IRpcChannel channel) {
- return new Stub(channel);
- }
-
- public class Stub : global::Google.ProtocolBuffers.TestProtos.TestServiceWithCustomOptions {
- internal Stub(pb::IRpcChannel channel) {
- this.channel = channel;
- }
-
- private readonly pb::IRpcChannel channel;
-
- public pb::IRpcChannel Channel {
- get { return channel; }
- }
-
- public override void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse> done) {
- channel.CallMethod(Descriptor.Methods[0],
- controller, request, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance));
- }
- }
- }
+ /*
+ * Service generation is now disabled by default, use the following option to enable:
+ * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+ */
#endregion
}
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs
new file mode 100644
index 00000000..51f16d25
--- /dev/null
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs
@@ -0,0 +1,250 @@
+// Generated by ProtoGen, Version=0.9.0.0, Culture=neutral, PublicKeyToken=8fd7408b07f8d2cd. DO NOT EDIT!
+
+using pb = global::Google.ProtocolBuffers;
+using pbc = global::Google.ProtocolBuffers.Collections;
+using pbd = global::Google.ProtocolBuffers.Descriptors;
+using scg = global::System.Collections.Generic;
+namespace Google.ProtocolBuffers.TestProtos {
+
+ public static partial class UnitTestGenericServices {
+
+ #region Extension registration
+ public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
+ }
+ #endregion
+ #region Static variables
+ #endregion
+ #region Descriptor
+ public static pbd::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbd::FileDescriptor descriptor;
+
+ static UnitTestGenericServices() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ "CiZleHRlc3QvdW5pdHRlc3RfZ2VuZXJpY19zZXJ2aWNlcy5wcm90bxIRcHJv" +
+ "dG9idWZfdW5pdHRlc3QaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9u" +
+ "cy5wcm90bxoeZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0LnByb3RvGi1nb29n" +
+ "bGUvcHJvdG9idWYvdW5pdHRlc3RfY3VzdG9tX29wdGlvbnMucHJvdG8yoAEK" +
+ "ElRlc3RHZW5lcmljU2VydmljZRJECgNGb28SHS5wcm90b2J1Zl91bml0dGVz" +
+ "dC5Gb29SZXF1ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuRm9vUmVzcG9uc2US" +
+ "RAoDQmFyEh0ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVxdWVzdBoeLnByb3Rv" +
+ "YnVmX3VuaXR0ZXN0LkJhclJlc3BvbnNlMpUBCiNUZXN0R2VuZXJpY1NlcnZp" +
+ "Y2VXaXRoQ3VzdG9tT3B0aW9ucxJjCgNGb28SKS5wcm90b2J1Zl91bml0dGVz" +
+ "dC5DdXN0b21PcHRpb25Gb29SZXF1ZXN0GioucHJvdG9idWZfdW5pdHRlc3Qu" +
+ "Q3VzdG9tT3B0aW9uRm9vUmVzcG9uc2UiBeD6jB4CGgmQsose09uAy0lCREgB" +
+ "wj4/CiFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MSF1VuaXRU" +
+ "ZXN0R2VuZXJpY1NlcnZpY2VziA4B");
+ pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
+ descriptor = root;
+ pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
+ RegisterAllExtensions(registry);
+ global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry);
+ global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RegisterAllExtensions(registry);
+ global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.RegisterAllExtensions(registry);
+ return registry;
+ };
+ pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+ new pbd::FileDescriptor[] {
+ global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor,
+ global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor,
+ global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor,
+ }, assigner);
+ }
+ #endregion
+
+ }
+ #region Services
+ public abstract class TestGenericService : pb::IService {
+ public abstract void Foo(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.FooRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done);
+ public abstract void Bar(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.BarRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done);
+
+ public static pbd::ServiceDescriptor Descriptor {
+ get { return UnitTestGenericServices.Descriptor.Services[0]; }
+ }
+ public pbd::ServiceDescriptor DescriptorForType {
+ get { return Descriptor; }
+ }
+
+ public void CallMethod(
+ pbd::MethodDescriptor method,
+ pb::IRpcController controller,
+ pb::IMessage request,
+ global::System.Action<pb::IMessage> done) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.CallMethod() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.FooRequest) request,
+ pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse>(
+ done));
+ return;
+ case 1:
+ this.Bar(controller, (global::Google.ProtocolBuffers.TestProtos.BarRequest) request,
+ pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse>(
+ done));
+ return;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.GetRequestPrototype() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance;
+ case 1:
+ return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.GetResponsePrototype() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance;
+ case 1:
+ return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public static Stub CreateStub(pb::IRpcChannel channel) {
+ return new Stub(channel);
+ }
+
+ public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericService {
+ internal Stub(pb::IRpcChannel channel) {
+ this.channel = channel;
+ }
+
+ private readonly pb::IRpcChannel channel;
+
+ public pb::IRpcChannel Channel {
+ get { return channel; }
+ }
+
+ public override void Foo(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.FooRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done) {
+ channel.CallMethod(Descriptor.Methods[0],
+ controller, request, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance,
+ pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse, global::Google.ProtocolBuffers.TestProtos.FooResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance));
+ }
+
+ public override void Bar(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.BarRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done) {
+ channel.CallMethod(Descriptor.Methods[1],
+ controller, request, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance,
+ pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse, global::Google.ProtocolBuffers.TestProtos.BarResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance));
+ }
+ }
+ }
+ public abstract class TestGenericServiceWithCustomOptions : pb::IService {
+ public abstract void Foo(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse> done);
+
+ public static pbd::ServiceDescriptor Descriptor {
+ get { return UnitTestGenericServices.Descriptor.Services[1]; }
+ }
+ public pbd::ServiceDescriptor DescriptorForType {
+ get { return Descriptor; }
+ }
+
+ public void CallMethod(
+ pbd::MethodDescriptor method,
+ pb::IRpcController controller,
+ pb::IMessage request,
+ global::System.Action<pb::IMessage> done) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.CallMethod() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest) request,
+ pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse>(
+ done));
+ return;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.GetRequestPrototype() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
+ if (method.Service != Descriptor) {
+ throw new global::System.ArgumentException(
+ "Service.GetResponsePrototype() given method descriptor for wrong service type.");
+ }
+ switch(method.Index) {
+ case 0:
+ return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance;
+ default:
+ throw new global::System.InvalidOperationException("Can't get here.");
+ }
+ }
+
+ public static Stub CreateStub(pb::IRpcChannel channel) {
+ return new Stub(channel);
+ }
+
+ public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericServiceWithCustomOptions {
+ internal Stub(pb::IRpcChannel channel) {
+ this.channel = channel;
+ }
+
+ private readonly pb::IRpcChannel channel;
+
+ public pb::IRpcChannel Channel {
+ get { return channel; }
+ }
+
+ public override void Foo(
+ pb::IRpcController controller,
+ global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request,
+ global::System.Action<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse> done) {
+ channel.CallMethod(Descriptor.Methods[0],
+ controller, request, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance,
+ pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance));
+ }
+ }
+ }
+ #endregion
+
+}
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
index bf77ccba..8d7c97a1 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
@@ -293,90 +293,10 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
#endregion
#region Services
- public abstract class TestService : pb::IService {
- public abstract void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage> done);
-
- public static pbd::ServiceDescriptor Descriptor {
- get { return UnitTestNoGenericServicesProtoFile.Descriptor.Services[0]; }
- }
- public pbd::ServiceDescriptor DescriptorForType {
- get { return Descriptor; }
- }
-
- public void CallMethod(
- pbd::MethodDescriptor method,
- pb::IRpcController controller,
- pb::IMessage request,
- global::System.Action<pb::IMessage> done) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.CallMethod() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage>(
- done));
- return;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetRequestPrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetResponsePrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public static Stub CreateStub(pb::IRpcChannel channel) {
- return new Stub(channel);
- }
-
- public class Stub : global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestService {
- internal Stub(pb::IRpcChannel channel) {
- this.channel = channel;
- }
-
- private readonly pb::IRpcChannel channel;
-
- public pb::IRpcChannel Channel {
- get { return channel; }
- }
-
- public override void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage> done) {
- channel.CallMethod(Descriptor.Methods[0],
- controller, request, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Builder>(done, global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance));
- }
- }
- }
+ /*
+ * Service generation is now disabled by default, use the following option to enable:
+ * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+ */
#endregion
}
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
index 2d86a64b..a02255d5 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
@@ -18512,112 +18512,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion
#region Services
- public abstract class TestService : pb::IService {
- public abstract void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.FooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done);
- public abstract void Bar(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.BarRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done);
-
- public static pbd::ServiceDescriptor Descriptor {
- get { return UnitTestProtoFile.Descriptor.Services[0]; }
- }
- public pbd::ServiceDescriptor DescriptorForType {
- get { return Descriptor; }
- }
-
- public void CallMethod(
- pbd::MethodDescriptor method,
- pb::IRpcController controller,
- pb::IMessage request,
- global::System.Action<pb::IMessage> done) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.CallMethod() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.FooRequest) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse>(
- done));
- return;
- case 1:
- this.Bar(controller, (global::Google.ProtocolBuffers.TestProtos.BarRequest) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse>(
- done));
- return;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetRequestPrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance;
- case 1:
- return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetResponsePrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance;
- case 1:
- return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public static Stub CreateStub(pb::IRpcChannel channel) {
- return new Stub(channel);
- }
-
- public class Stub : global::Google.ProtocolBuffers.TestProtos.TestService {
- internal Stub(pb::IRpcChannel channel) {
- this.channel = channel;
- }
-
- private readonly pb::IRpcChannel channel;
-
- public pb::IRpcChannel Channel {
- get { return channel; }
- }
-
- public override void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.FooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done) {
- channel.CallMethod(Descriptor.Methods[0],
- controller, request, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse, global::Google.ProtocolBuffers.TestProtos.FooResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance));
- }
-
- public override void Bar(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.BarRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done) {
- channel.CallMethod(Descriptor.Methods[1],
- controller, request, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse, global::Google.ProtocolBuffers.TestProtos.BarResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance));
- }
- }
- }
+ /*
+ * Service generation is now disabled by default, use the following option to enable:
+ * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+ */
#endregion
}
diff --git a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
index 7eef5708..855f8fe6 100644
--- a/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+++ b/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
@@ -47,7 +47,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
byte[] descriptorData = global::System.Convert.FromBase64String(
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" +
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" +
- "uQMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
+ "tgMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
"bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" +
"KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" +
"c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" +
@@ -55,22 +55,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
"CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" +
"dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" +
"GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" +
- "ZmFsc2USTAoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" +
- "bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6B0dFTkVSSUMiKwoSQ1No" +
- "YXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1No" +
- "YXJwU2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NT" +
- "aGFycE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqQQoRQ1No" +
- "YXJwU2VydmljZVR5cGUSCwoHR0VORVJJQxABEg0KCUlOVEVSRkFDRRACEhAK" +
- "DElSUENESVNQQVRDSBADOl4KE2NzaGFycF9maWxlX29wdGlvbnMSHC5nb29n" +
- "bGUucHJvdG9idWYuRmlsZU9wdGlvbnMY6AcgASgLMiIuZ29vZ2xlLnByb3Rv" +
- "YnVmLkNTaGFycEZpbGVPcHRpb25zOmEKFGNzaGFycF9maWVsZF9vcHRpb25z" +
- "Eh0uZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxjoByABKAsyIy5nb29n" +
- "bGUucHJvdG9idWYuQ1NoYXJwRmllbGRPcHRpb25zOmcKFmNzaGFycF9zZXJ2" +
- "aWNlX29wdGlvbnMSHy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMY" +
- "6AcgASgLMiUuZ29vZ2xlLnByb3RvYnVmLkNTaGFycFNlcnZpY2VPcHRpb25z" +
- "OmQKFWNzaGFycF9tZXRob2Rfb3B0aW9ucxIeLmdvb2dsZS5wcm90b2J1Zi5N" +
- "ZXRob2RPcHRpb25zGOgHIAEoCzIkLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBN" +
- "ZXRob2RPcHRpb25z");
+ "ZmFsc2USSQoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" +
+ "bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6BE5PTkUiKwoSQ1NoYXJw" +
+ "RmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1NoYXJw" +
+ "U2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NTaGFy" +
+ "cE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqSwoRQ1NoYXJw" +
+ "U2VydmljZVR5cGUSCAoETk9ORRAAEgsKB0dFTkVSSUMQARINCglJTlRFUkZB" +
+ "Q0UQAhIQCgxJUlBDRElTUEFUQ0gQAzpeChNjc2hhcnBfZmlsZV9vcHRpb25z" +
+ "EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGOgHIAEoCzIiLmdvb2ds" +
+ "ZS5wcm90b2J1Zi5DU2hhcnBGaWxlT3B0aW9uczphChRjc2hhcnBfZmllbGRf" +
+ "b3B0aW9ucxIdLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMY6AcgASgL" +
+ "MiMuZ29vZ2xlLnByb3RvYnVmLkNTaGFycEZpZWxkT3B0aW9uczpnChZjc2hh" +
+ "cnBfc2VydmljZV9vcHRpb25zEh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VP" +
+ "cHRpb25zGOgHIAEoCzIlLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBTZXJ2aWNl" +
+ "T3B0aW9uczpkChVjc2hhcnBfbWV0aG9kX29wdGlvbnMSHi5nb29nbGUucHJv" +
+ "dG9idWYuTWV0aG9kT3B0aW9ucxjoByABKAsyJC5nb29nbGUucHJvdG9idWYu" +
+ "Q1NoYXJwTWV0aG9kT3B0aW9ucw==");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0];
@@ -105,6 +105,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
#region Enums
public enum CSharpServiceType {
+ NONE = 0,
GENERIC = 1,
INTERFACE = 2,
IRPCDISPATCH = 3,
@@ -257,7 +258,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public const int ServiceGeneratorTypeFieldNumber = 225;
private bool hasServiceGeneratorType;
- private global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.GENERIC;
+ private global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE;
public bool HasServiceGeneratorType {
get { return hasServiceGeneratorType; }
}
@@ -824,7 +825,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
}
public Builder ClearServiceGeneratorType() {
result.hasServiceGeneratorType = false;
- result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.GENERIC;
+ result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE;
return this;
}
}
diff --git a/src/ProtocolBuffers2008.sln b/src/ProtocolBuffers2008.sln
index a73fdd44..93b95508 100644
--- a/src/ProtocolBuffers2008.sln
+++ b/src/ProtocolBuffers2008.sln
@@ -16,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8
..\protos\google\protobuf\unittest_embed_optimize_for.proto = ..\protos\google\protobuf\unittest_embed_optimize_for.proto
..\protos\google\protobuf\unittest_empty.proto = ..\protos\google\protobuf\unittest_empty.proto
..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.proto
+ ..\protos\extest\unittest_extras_full.proto = ..\protos\extest\unittest_extras_full.proto
..\protos\extest\unittest_extras_lite.proto = ..\protos\extest\unittest_extras_lite.proto
..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto
..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto
@@ -24,6 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8
..\protos\google\protobuf\unittest_mset.proto = ..\protos\google\protobuf\unittest_mset.proto
..\protos\google\protobuf\unittest_no_generic_services.proto = ..\protos\google\protobuf\unittest_no_generic_services.proto
..\protos\google\protobuf\unittest_optimize_for.proto = ..\protos\google\protobuf\unittest_optimize_for.proto
+ ..\protos\extest\unittest_generic_services.proto = ..\protos\extest\unittest_generic_services.proto
..\protos\extest\unittest_rpc_interop.proto = ..\protos\extest\unittest_rpc_interop.proto
EndProjectSection
EndProject
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
index 2d86a64b..a02255d5 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
@@ -18512,112 +18512,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion
#region Services
- public abstract class TestService : pb::IService {
- public abstract void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.FooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done);
- public abstract void Bar(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.BarRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done);
-
- public static pbd::ServiceDescriptor Descriptor {
- get { return UnitTestProtoFile.Descriptor.Services[0]; }
- }
- public pbd::ServiceDescriptor DescriptorForType {
- get { return Descriptor; }
- }
-
- public void CallMethod(
- pbd::MethodDescriptor method,
- pb::IRpcController controller,
- pb::IMessage request,
- global::System.Action<pb::IMessage> done) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.CallMethod() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.FooRequest) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse>(
- done));
- return;
- case 1:
- this.Bar(controller, (global::Google.ProtocolBuffers.TestProtos.BarRequest) request,
- pb::RpcUtil.SpecializeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse>(
- done));
- return;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetRequestPrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance;
- case 1:
- return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
- if (method.Service != Descriptor) {
- throw new global::System.ArgumentException(
- "Service.GetResponsePrototype() given method descriptor for wrong service type.");
- }
- switch(method.Index) {
- case 0:
- return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance;
- case 1:
- return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance;
- default:
- throw new global::System.InvalidOperationException("Can't get here.");
- }
- }
-
- public static Stub CreateStub(pb::IRpcChannel channel) {
- return new Stub(channel);
- }
-
- public class Stub : global::Google.ProtocolBuffers.TestProtos.TestService {
- internal Stub(pb::IRpcChannel channel) {
- this.channel = channel;
- }
-
- private readonly pb::IRpcChannel channel;
-
- public pb::IRpcChannel Channel {
- get { return channel; }
- }
-
- public override void Foo(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.FooRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.FooResponse> done) {
- channel.CallMethod(Descriptor.Methods[0],
- controller, request, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.FooResponse, global::Google.ProtocolBuffers.TestProtos.FooResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance));
- }
-
- public override void Bar(
- pb::IRpcController controller,
- global::Google.ProtocolBuffers.TestProtos.BarRequest request,
- global::System.Action<global::Google.ProtocolBuffers.TestProtos.BarResponse> done) {
- channel.CallMethod(Descriptor.Methods[1],
- controller, request, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance,
- pb::RpcUtil.GeneralizeCallback<global::Google.ProtocolBuffers.TestProtos.BarResponse, global::Google.ProtocolBuffers.TestProtos.BarResponse.Builder>(done, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance));
- }
- }
- }
+ /*
+ * Service generation is now disabled by default, use the following option to enable:
+ * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+ */
#endregion
}