- Added CSharpServiceType NONE to skip service generation.

- Defaulted service_generator_type to NONE
- Added /protos/extest/unittest_generic_services.proto to test services
- Migrated unit tests to use the new generic services for testing
pull/288/head
csharptest 14 years ago committed by rogerk
parent 68d831e3a4
commit f1816beebe
  1. 4
      build/build.csproj
  2. 29
      protos/extest/unittest_generic_services.proto
  3. 4
      protos/google/protobuf/csharp_options.proto
  4. 16
      src/ProtoGen/ServiceInterfaceGenerator.cs
  5. 30
      src/ProtocolBuffers.Test/DescriptorsTest.cs
  6. 1
      src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
  7. 34
      src/ProtocolBuffers.Test/ServiceTest.cs
  8. 88
      src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
  9. 250
      src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs
  10. 88
      src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs
  11. 110
      src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
  12. 39
      src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
  13. 2
      src/ProtocolBuffers2008.sln
  14. 110
      src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs

@ -38,6 +38,7 @@
<Protos Include="$(ProtosDirectory)\extest\unittest_extras_full.proto" /> <Protos Include="$(ProtosDirectory)\extest\unittest_extras_full.proto" />
<Protos Include="$(ProtosDirectory)\extest\unittest_extras_lite.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)\extest\unittest_rpc_interop.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\descriptor.proto" /> <Protos Include="$(ProtosDirectory)\google\protobuf\descriptor.proto" />
<Protos Include="$(ProtosDirectory)\google\protobuf\csharp_options.proto" /> <Protos Include="$(ProtosDirectory)\google\protobuf\csharp_options.proto" />
@ -101,6 +102,9 @@
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestRpcInterop.cs"> <GeneratedSource Include="$(BuildTempDirectory)\UnitTestRpcInterop.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory> <TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
</GeneratedSource> </GeneratedSource>
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestGenericServices.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffers.Test\TestProtos</TargetDirectory>
</GeneratedSource>
<!-- Lite unit test --> <!-- Lite unit test -->
<GeneratedSource Include="$(BuildTempDirectory)\UnitTestExtrasFullProtoFile.cs"> <GeneratedSource Include="$(BuildTempDirectory)\UnitTestExtrasFullProtoFile.cs">
<TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory> <TargetDirectory>$(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos</TargetDirectory>

@ -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;
}
}

@ -58,10 +58,12 @@ message CSharpFileOptions {
// Controls how services are generated, GENERIC is the deprecated original implementation // Controls how services are generated, GENERIC is the deprecated original implementation
// INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and // INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and
// implementations using the included Windows RPC interop libarary. // 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 { enum CSharpServiceType {
// Services are ignored by the generator
NONE = 0;
// Generates the original Java generic service implementations // Generates the original Java generic service implementations
GENERIC = 1; GENERIC = 1;
// Generates an interface for the service and nothing else // Generates an interface for the service and nothing else

@ -47,6 +47,9 @@ namespace Google.ProtocolBuffers.ProtoGen {
: base(descriptor) { : base(descriptor) {
svcType = descriptor.File.CSharpOptions.ServiceGeneratorType; svcType = descriptor.File.CSharpOptions.ServiceGeneratorType;
switch (svcType) { switch (svcType) {
case CSharpServiceType.NONE:
_generator = new NoServicesGenerator(descriptor);
break;
case CSharpServiceType.GENERIC: case CSharpServiceType.GENERIC:
_generator = new GenericServiceGenerator(descriptor); _generator = new GenericServiceGenerator(descriptor);
break; break;
@ -63,6 +66,19 @@ namespace Google.ProtocolBuffers.ProtoGen {
public void Generate(TextGenerator writer) { public void Generate(TextGenerator writer) {
_generator.Generate(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 { class ServiceInterfaceGenerator : SourceGeneratorBase<ServiceDescriptor>, ISourceGenerator {

@ -75,13 +75,13 @@ namespace Google.ProtocolBuffers {
Assert.AreEqual("ImportEnum", UnitTestImportProtoFile.Descriptor.EnumTypes[0].Name); Assert.AreEqual("ImportEnum", UnitTestImportProtoFile.Descriptor.EnumTypes[0].Name);
for (int i = 0; i < file.EnumTypes.Count; i++) { for (int i = 0; i < file.EnumTypes.Count; i++) {
Assert.AreEqual(i, file.EnumTypes[i].Index); Assert.AreEqual(i, file.EnumTypes[i].Index);
} }
ServiceDescriptor service = TestService.Descriptor; ServiceDescriptor service = TestGenericService.Descriptor;
Assert.AreEqual(service, file.Services[0]); Assert.AreEqual(service, UnitTestGenericServices.Descriptor.Services[0]);
Assert.AreEqual(service, file.FindTypeByName<ServiceDescriptor>("TestService")); Assert.AreEqual(service, UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("TestGenericService"));
Assert.IsNull(file.FindTypeByName<ServiceDescriptor>("NoSuchType")); Assert.IsNull(UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("NoSuchType"));
Assert.IsNull(file.FindTypeByName<ServiceDescriptor>("protobuf_unittest.TestService")); Assert.IsNull(UnitTestGenericServices.Descriptor.FindTypeByName<ServiceDescriptor>("protobuf_unittest.TestGenericService"));
Assert.AreEqual(0, UnitTestImportProtoFile.Descriptor.Services.Count); Assert.AreEqual(0, UnitTestImportProtoFile.Descriptor.Services.Count);
for (int i = 0; i < file.Services.Count; i++) { for (int i = 0; i < file.Services.Count; i++) {
Assert.AreEqual(i, file.Services[i].Index); Assert.AreEqual(i, file.Services[i].Index);
@ -261,11 +261,11 @@ namespace Google.ProtocolBuffers {
[Test] [Test]
public void ServiceDescriptor() { public void ServiceDescriptor() {
ServiceDescriptor service = TestService.Descriptor; ServiceDescriptor service = TestGenericService.Descriptor;
Assert.AreEqual("TestService", service.Name); Assert.AreEqual("TestGenericService", service.Name);
Assert.AreEqual("protobuf_unittest.TestService", service.FullName); Assert.AreEqual("protobuf_unittest.TestGenericService", service.FullName);
Assert.AreEqual(UnitTestProtoFile.Descriptor, service.File); Assert.AreEqual(UnitTestGenericServices.Descriptor, service.File);
Assert.AreEqual(2, service.Methods.Count); Assert.AreEqual(2, service.Methods.Count);
@ -310,9 +310,9 @@ namespace Google.ProtocolBuffers {
enumType.getOptions().hasExtension(UnittestCustomOptions.enumOpt1)); enumType.getOptions().hasExtension(UnittestCustomOptions.enumOpt1));
Assert.AreEqual(Integer.valueOf(-789), Assert.AreEqual(Integer.valueOf(-789),
enumType.getOptions().getExtension(UnittestCustomOptions.enumOpt1)); enumType.getOptions().getExtension(UnittestCustomOptions.enumOpt1));
*/ */
ServiceDescriptor service = TestServiceWithCustomOptions.Descriptor; ServiceDescriptor service = TestGenericServiceWithCustomOptions.Descriptor;
Assert.IsTrue(service.Options.HasExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1)); Assert.IsTrue(service.Options.HasExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1));
Assert.AreEqual(-9876543210L, service.Options.GetExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1)); Assert.AreEqual(-9876543210L, service.Options.GetExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1));

@ -92,6 +92,7 @@
<Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" /> <Compile Include="TestProtos\UnitTestCustomOptionsProtoFile.cs" />
<Compile Include="TestProtos\UnitTestEmbedOptimizeForProtoFile.cs" /> <Compile Include="TestProtos\UnitTestEmbedOptimizeForProtoFile.cs" />
<Compile Include="TestProtos\UnitTestEmptyProtoFile.cs" /> <Compile Include="TestProtos\UnitTestEmptyProtoFile.cs" />
<Compile Include="TestProtos\UnitTestGenericServices.cs" />
<Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" /> <Compile Include="TestProtos\UnitTestImportLiteProtoFile.cs" />
<Compile Include="TestProtos\UnitTestImportProtoFile.cs" /> <Compile Include="TestProtos\UnitTestImportProtoFile.cs" />
<Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" /> <Compile Include="TestProtos\UnitTestMessageSetProtoFile.cs" />

@ -50,12 +50,12 @@ namespace Google.ProtocolBuffers {
delegate void Action<T1, T2>(T1 t1, T2 t2); delegate void Action<T1, T2>(T1 t1, T2 t2);
private static readonly MethodDescriptor FooDescriptor = TestService.Descriptor.Methods[0]; private static readonly MethodDescriptor FooDescriptor = TestGenericService.Descriptor.Methods[0];
private static readonly MethodDescriptor BarDescriptor = TestService.Descriptor.Methods[1]; private static readonly MethodDescriptor BarDescriptor = TestGenericService.Descriptor.Methods[1];
[Test] [Test]
public void GetRequestPrototype() { public void GetRequestPrototype() {
TestService service = new TestServiceImpl(); TestGenericService service = new TestServiceImpl();
Assert.AreSame(service.GetRequestPrototype(FooDescriptor), FooRequest.DefaultInstance); Assert.AreSame(service.GetRequestPrototype(FooDescriptor), FooRequest.DefaultInstance);
Assert.AreSame(service.GetRequestPrototype(BarDescriptor), BarRequest.DefaultInstance); Assert.AreSame(service.GetRequestPrototype(BarDescriptor), BarRequest.DefaultInstance);
@ -63,7 +63,7 @@ namespace Google.ProtocolBuffers {
[Test] [Test]
public void GetResponsePrototype() { public void GetResponsePrototype() {
TestService service = new TestServiceImpl(); TestGenericService service = new TestServiceImpl();
Assert.AreSame(service.GetResponsePrototype(FooDescriptor), FooResponse.DefaultInstance); Assert.AreSame(service.GetResponsePrototype(FooDescriptor), FooResponse.DefaultInstance);
Assert.AreSame(service.GetResponsePrototype(BarDescriptor), BarResponse.DefaultInstance); Assert.AreSame(service.GetResponsePrototype(BarDescriptor), BarResponse.DefaultInstance);
@ -71,14 +71,14 @@ namespace Google.ProtocolBuffers {
[Test] [Test]
public void CallMethodFoo() { public void CallMethodFoo() {
MockRepository mocks = new MockRepository(); MockRepository mocks = new MockRepository();
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); FooRequest fooRequest = FooRequest.CreateBuilder().Build();
FooResponse fooResponse = FooResponse.CreateBuilder().Build(); FooResponse fooResponse = FooResponse.CreateBuilder().Build();
IRpcController controller = mocks.StrictMock<IRpcController>(); IRpcController controller = mocks.StrictMock<IRpcController>();
bool fooCalled = false; bool fooCalled = false;
TestService service = new TestServiceImpl((request, responseAction) => { TestGenericService service = new TestServiceImpl((request, responseAction) => {
Assert.AreSame(fooRequest, request); Assert.AreSame(fooRequest, request);
fooCalled = true; fooCalled = true;
responseAction(fooResponse); responseAction(fooResponse);
@ -115,8 +115,8 @@ namespace Google.ProtocolBuffers {
FooRequest fooRequest = FooRequest.CreateBuilder().Build(); FooRequest fooRequest = FooRequest.CreateBuilder().Build();
MockRepository mocks = new MockRepository(); MockRepository mocks = new MockRepository();
IRpcChannel mockChannel = mocks.StrictMock<IRpcChannel>(); IRpcChannel mockChannel = mocks.StrictMock<IRpcChannel>();
IRpcController mockController = mocks.StrictMock<IRpcController>(); IRpcController mockController = mocks.StrictMock<IRpcController>();
TestService service = TestService.CreateStub(mockChannel); TestGenericService service = TestGenericService.CreateStub(mockChannel);
Action<FooResponse> doneHandler = mocks.StrictMock<Action<FooResponse>>(); Action<FooResponse> doneHandler = mocks.StrictMock<Action<FooResponse>>();
using (mocks.Record()) { using (mocks.Record()) {
@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers {
.IgnoreArguments() .IgnoreArguments()
.Constraints(Is.Same(FooDescriptor), Is.Same(mockController), Is.Same(fooRequest), .Constraints(Is.Same(FooDescriptor), Is.Same(mockController), Is.Same(fooRequest),
Is.Same(FooResponse.DefaultInstance), Is.Anything()) 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); doneHandler(FooResponse.DefaultInstance);
} }
@ -137,14 +137,14 @@ namespace Google.ProtocolBuffers {
[Test] [Test]
public void CallMethodBar() { public void CallMethodBar() {
MockRepository mocks = new MockRepository(); MockRepository mocks = new MockRepository();
BarRequest barRequest = BarRequest.CreateBuilder().Build(); BarRequest barRequest = BarRequest.CreateBuilder().Build();
BarResponse barResponse = BarResponse.CreateBuilder().Build(); BarResponse barResponse = BarResponse.CreateBuilder().Build();
IRpcController controller = mocks.StrictMock<IRpcController>(); IRpcController controller = mocks.StrictMock<IRpcController>();
bool barCalled = false; bool barCalled = false;
TestService service = new TestServiceImpl(null, (request, responseAction) => { TestGenericService service = new TestServiceImpl(null, (request, responseAction) => {
Assert.AreSame(barRequest, request); Assert.AreSame(barRequest, request);
barCalled = true; barCalled = true;
responseAction(barResponse); 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<FooRequest, Action<FooResponse>> fooHandler;
private readonly Action<BarRequest, Action<BarResponse>> barHandler; private readonly Action<BarRequest, Action<BarResponse>> barHandler;
private readonly IRpcController expectedController; private readonly IRpcController expectedController;
internal TestServiceImpl() { internal TestServiceImpl() {
} }
internal TestServiceImpl(Action<FooRequest, Action<FooResponse>> fooHandler, internal TestServiceImpl(Action<FooRequest, Action<FooResponse>> fooHandler,
Action<BarRequest, Action<BarResponse>> barHandler, Action<BarRequest, Action<BarResponse>> barHandler,
IRpcController expectedController) { IRpcController expectedController) {
this.fooHandler = fooHandler; this.fooHandler = fooHandler;

@ -3957,90 +3957,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion #endregion
#region Services #region Services
public abstract class TestServiceWithCustomOptions : pb::IService { /*
public abstract void Foo( * Service generation is now disabled by default, use the following option to enable:
pb::IRpcController controller, * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
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));
}
}
}
#endregion #endregion
} }

@ -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
}

@ -293,90 +293,10 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
#endregion #endregion
#region Services #region Services
public abstract class TestService : pb::IService { /*
public abstract void Foo( * Service generation is now disabled by default, use the following option to enable:
pb::IRpcController controller, * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
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));
}
}
}
#endregion #endregion
} }

@ -18512,112 +18512,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion #endregion
#region Services #region Services
public abstract class TestService : pb::IService { /*
public abstract void Foo( * Service generation is now disabled by default, use the following option to enable:
pb::IRpcController controller, * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
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));
}
}
}
#endregion #endregion
} }

@ -47,7 +47,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" + "CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds" +
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" + "ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i" +
"uQMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" + "tgMKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1" +
"bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" + "bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB" +
"KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" + "KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz" +
"c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" + "c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u" +
@ -55,22 +55,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
"CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" + "CCABKAg6BHRydWUSHAoOZmlsZV9leHRlbnNpb24Y3QEgASgJOgMuY3MSGwoS" +
"dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" + "dW1icmVsbGFfbmFtZXNwYWNlGN4BIAEoCRIcChBvdXRwdXRfZGlyZWN0b3J5" +
"GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" + "GN8BIAEoCToBLhImChZpZ25vcmVfZ29vZ2xlX3Byb3RvYnVmGOABIAEoCDoF" +
"ZmFsc2USTAoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" + "ZmFsc2USSQoWc2VydmljZV9nZW5lcmF0b3JfdHlwZRjhASABKA4yIi5nb29n" +
"bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6B0dFTkVSSUMiKwoSQ1No" + "bGUucHJvdG9idWYuQ1NoYXJwU2VydmljZVR5cGU6BE5PTkUiKwoSQ1NoYXJw" +
"YXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1No" + "RmllbGRPcHRpb25zEhUKDXByb3BlcnR5X25hbWUYASABKAkiLAoUQ1NoYXJw" +
"YXJwU2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NT" + "U2VydmljZU9wdGlvbnMSFAoMaW50ZXJmYWNlX2lkGAEgASgJIioKE0NTaGFy" +
"aGFycE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqQQoRQ1No" + "cE1ldGhvZE9wdGlvbnMSEwoLZGlzcGF0Y2hfaWQYASABKAUqSwoRQ1NoYXJw" +
"YXJwU2VydmljZVR5cGUSCwoHR0VORVJJQxABEg0KCUlOVEVSRkFDRRACEhAK" + "U2VydmljZVR5cGUSCAoETk9ORRAAEgsKB0dFTkVSSUMQARINCglJTlRFUkZB" +
"DElSUENESVNQQVRDSBADOl4KE2NzaGFycF9maWxlX29wdGlvbnMSHC5nb29n" + "Q0UQAhIQCgxJUlBDRElTUEFUQ0gQAzpeChNjc2hhcnBfZmlsZV9vcHRpb25z" +
"bGUucHJvdG9idWYuRmlsZU9wdGlvbnMY6AcgASgLMiIuZ29vZ2xlLnByb3Rv" + "EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGOgHIAEoCzIiLmdvb2ds" +
"YnVmLkNTaGFycEZpbGVPcHRpb25zOmEKFGNzaGFycF9maWVsZF9vcHRpb25z" + "ZS5wcm90b2J1Zi5DU2hhcnBGaWxlT3B0aW9uczphChRjc2hhcnBfZmllbGRf" +
"Eh0uZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucxjoByABKAsyIy5nb29n" + "b3B0aW9ucxIdLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMY6AcgASgL" +
"bGUucHJvdG9idWYuQ1NoYXJwRmllbGRPcHRpb25zOmcKFmNzaGFycF9zZXJ2" + "MiMuZ29vZ2xlLnByb3RvYnVmLkNTaGFycEZpZWxkT3B0aW9uczpnChZjc2hh" +
"aWNlX29wdGlvbnMSHy5nb29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMY" + "cnBfc2VydmljZV9vcHRpb25zEh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VP" +
"6AcgASgLMiUuZ29vZ2xlLnByb3RvYnVmLkNTaGFycFNlcnZpY2VPcHRpb25z" + "cHRpb25zGOgHIAEoCzIlLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBTZXJ2aWNl" +
"OmQKFWNzaGFycF9tZXRob2Rfb3B0aW9ucxIeLmdvb2dsZS5wcm90b2J1Zi5N" + "T3B0aW9uczpkChVjc2hhcnBfbWV0aG9kX29wdGlvbnMSHi5nb29nbGUucHJv" +
"ZXRob2RPcHRpb25zGOgHIAEoCzIkLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBN" + "dG9idWYuTWV0aG9kT3B0aW9ucxjoByABKAsyJC5nb29nbGUucHJvdG9idWYu" +
"ZXRob2RPcHRpb25z"); "Q1NoYXJwTWV0aG9kT3B0aW9ucw==");
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root; descriptor = root;
internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0]; internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0];
@ -105,6 +105,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
} }
#region Enums #region Enums
public enum CSharpServiceType { public enum CSharpServiceType {
NONE = 0,
GENERIC = 1, GENERIC = 1,
INTERFACE = 2, INTERFACE = 2,
IRPCDISPATCH = 3, IRPCDISPATCH = 3,
@ -257,7 +258,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public const int ServiceGeneratorTypeFieldNumber = 225; public const int ServiceGeneratorTypeFieldNumber = 225;
private bool hasServiceGeneratorType; 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 { public bool HasServiceGeneratorType {
get { return hasServiceGeneratorType; } get { return hasServiceGeneratorType; }
} }
@ -824,7 +825,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
} }
public Builder ClearServiceGeneratorType() { public Builder ClearServiceGeneratorType() {
result.hasServiceGeneratorType = false; result.hasServiceGeneratorType = false;
result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.GENERIC; result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE;
return this; return this;
} }
} }

@ -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_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_empty.proto = ..\protos\google\protobuf\unittest_empty.proto
..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.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\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.proto = ..\protos\google\protobuf\unittest_import.proto
..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.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_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_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\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 ..\protos\extest\unittest_rpc_interop.proto = ..\protos\extest\unittest_rpc_interop.proto
EndProjectSection EndProjectSection
EndProject EndProject

@ -18512,112 +18512,10 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion #endregion
#region Services #region Services
public abstract class TestService : pb::IService { /*
public abstract void Foo( * Service generation is now disabled by default, use the following option to enable:
pb::IRpcController controller, * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
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));
}
}
}
#endregion #endregion
} }

Loading…
Cancel
Save