├── server
├── App.config
├── CalculatorServiceImpl.cs
├── packages.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── server.csproj
└── models
│ ├── CalculatorGrpc.cs
│ └── Calculator.cs
├── calculator.proto
├── client
├── App.config
├── packages.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── client.csproj
└── models
│ ├── CalculatorGrpc.cs
│ └── Calculator.cs
├── sum-unary-api.sln
├── .gitattributes
└── .gitignore
/server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/calculator.proto:
--------------------------------------------------------------------------------
1 | //definition for grpc services
2 |
3 | syntax = "proto3";
4 |
5 | package calculator;
6 |
7 | message SumRequest {
8 | int32 a = 1;
9 | int32 b = 2;
10 | }
11 |
12 | message SumResponse {
13 | int32 result = 1;
14 | }
15 |
16 | service CalculatorService {
17 | rpc Sum(SumRequest) returns (SumResponse) {}
18 | }
--------------------------------------------------------------------------------
/server/CalculatorServiceImpl.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Calculator;
3 | using Grpc.Core;
4 | using static Calculator.CalculatorService;
5 |
6 | namespace server
7 | {
8 | public class CalculatorServiceImpl : CalculatorServiceBase
9 | {
10 | public override Task Sum(SumRequest request, ServerCallContext context)
11 | {
12 | int result = request.A + request.B;
13 |
14 | return Task.FromResult(new SumResponse {Result = result});
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/client/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/server/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Calculator;
4 | using Grpc.Core;
5 |
6 | namespace client
7 | {
8 | internal class Program
9 | {
10 | private const string target = "127.0.0.1:50052";
11 |
12 | private static void Main(string[] args)
13 | {
14 | var channel = new Channel(target, ChannelCredentials.Insecure);
15 |
16 | channel.ConnectAsync().ContinueWith(task =>
17 | {
18 | if (task.Status == TaskStatus.RanToCompletion)
19 | Console.WriteLine("The client connected successfully");
20 | });
21 |
22 | var client = new CalculatorService.CalculatorServiceClient(channel);
23 |
24 | var request = new SumRequest
25 | {
26 | A = 3,
27 | B = 10
28 | };
29 |
30 | var response = client.Sum(request);
31 |
32 | Console.WriteLine(response.Result);
33 |
34 | channel.ShutdownAsync().Wait();
35 | Console.ReadKey();
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/server/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Calculator;
4 | using Grpc.Core;
5 |
6 | namespace server
7 | {
8 | internal class Program
9 | {
10 | private const int Port = 50052;
11 |
12 | private static void Main(string[] args)
13 | {
14 | Server server = null;
15 |
16 | try
17 | {
18 | server = new Server
19 | {
20 | Services = {CalculatorService.BindService(new CalculatorServiceImpl())},
21 | Ports = {new ServerPort("localhost", Port, ServerCredentials.Insecure)}
22 | };
23 |
24 | server.Start();
25 | Console.WriteLine("The server is listening on the port : " + Port);
26 | Console.ReadKey();
27 | }
28 | catch (IOException e)
29 | {
30 | Console.WriteLine("The server failed to start : " + e.Message);
31 | throw;
32 | }
33 | finally
34 | {
35 | if (server != null)
36 | server.ShutdownAsync().Wait();
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("client")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("client")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("bab76262-3b4d-4e1e-ac0a-c31874976c99")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("server")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("server")]
12 | [assembly: AssemblyCopyright("Copyright © 2019")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("2dd46579-e85a-4455-827c-248de906b148")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/sum-unary-api.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29411.108
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "proto", "proto", "{AD19FA01-EA39-412D-B0F7-E8CF4E21080B}"
7 | ProjectSection(SolutionItems) = preProject
8 | calculator.proto = calculator.proto
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client", "client\client.csproj", "{BAB76262-3B4D-4E1E-AC0A-C31874976C99}"
12 | EndProject
13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "server", "server\server.csproj", "{2DD46579-E85A-4455-827C-248DE906B148}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {BAB76262-3B4D-4E1E-AC0A-C31874976C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {BAB76262-3B4D-4E1E-AC0A-C31874976C99}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {BAB76262-3B4D-4E1E-AC0A-C31874976C99}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {BAB76262-3B4D-4E1E-AC0A-C31874976C99}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {2DD46579-E85A-4455-827C-248DE906B148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {2DD46579-E85A-4455-827C-248DE906B148}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {2DD46579-E85A-4455-827C-248DE906B148}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {2DD46579-E85A-4455-827C-248DE906B148}.Release|Any CPU.Build.0 = Release|Any CPU
29 | EndGlobalSection
30 | GlobalSection(SolutionProperties) = preSolution
31 | HideSolutionNode = FALSE
32 | EndGlobalSection
33 | GlobalSection(ExtensibilityGlobals) = postSolution
34 | SolutionGuid = {9A5DA9DD-9124-4642-AB25-6CFCF8040D30}
35 | EndGlobalSection
36 | EndGlobal
37 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/client/client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {BAB76262-3B4D-4E1E-AC0A-C31874976C99}
9 | Exe
10 | client
11 | client
12 | v4.7.2
13 | 512
14 | true
15 | true
16 |
17 |
18 |
19 |
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 |
40 | ..\packages\Google.Protobuf.3.19.1\lib\net45\Google.Protobuf.dll
41 |
42 |
43 | ..\packages\Grpc.Core.2.43.0\lib\net45\Grpc.Core.dll
44 |
45 |
46 | ..\packages\Grpc.Core.Api.2.43.0\lib\net45\Grpc.Core.Api.dll
47 |
48 |
49 |
50 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
51 |
52 |
53 |
54 | ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
55 |
56 |
57 |
58 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
59 |
60 |
61 | ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/server/server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {2DD46579-E85A-4455-827C-248DE906B148}
9 | Exe
10 | server
11 | server
12 | v4.7.2
13 | 512
14 | true
15 | true
16 |
17 |
18 |
19 |
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 |
40 | ..\packages\Google.Protobuf.3.10.0\lib\net45\Google.Protobuf.dll
41 |
42 |
43 | ..\packages\Grpc.Core.2.24.0\lib\net45\Grpc.Core.dll
44 |
45 |
46 | ..\packages\Grpc.Core.Api.2.24.0\lib\net45\Grpc.Core.Api.dll
47 |
48 |
49 |
50 | ..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
51 |
52 |
53 |
54 | ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
55 |
56 |
57 |
58 | ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll
59 |
60 |
61 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/server/models/CalculatorGrpc.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Generated by the protocol buffer compiler. DO NOT EDIT!
3 | // source: calculator.proto
4 | //
5 | // Original file comments:
6 | // definition for grpc services
7 | //
8 | #pragma warning disable 0414, 1591
9 | #region Designer generated code
10 |
11 | using grpc = global::Grpc.Core;
12 |
13 | namespace Calculator {
14 | public static partial class CalculatorService
15 | {
16 | static readonly string __ServiceName = "calculator.CalculatorService";
17 |
18 | static readonly grpc::Marshaller __Marshaller_calculator_SumRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Calculator.SumRequest.Parser.ParseFrom);
19 | static readonly grpc::Marshaller __Marshaller_calculator_SumResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Calculator.SumResponse.Parser.ParseFrom);
20 |
21 | static readonly grpc::Method __Method_Sum = new grpc::Method(
22 | grpc::MethodType.Unary,
23 | __ServiceName,
24 | "Sum",
25 | __Marshaller_calculator_SumRequest,
26 | __Marshaller_calculator_SumResponse);
27 |
28 | /// Service descriptor
29 | public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
30 | {
31 | get { return global::Calculator.CalculatorReflection.Descriptor.Services[0]; }
32 | }
33 |
34 | /// Base class for server-side implementations of CalculatorService
35 | [grpc::BindServiceMethod(typeof(CalculatorService), "BindService")]
36 | public abstract partial class CalculatorServiceBase
37 | {
38 | public virtual global::System.Threading.Tasks.Task Sum(global::Calculator.SumRequest request, grpc::ServerCallContext context)
39 | {
40 | throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
41 | }
42 |
43 | }
44 |
45 | /// Client for CalculatorService
46 | public partial class CalculatorServiceClient : grpc::ClientBase
47 | {
48 | /// Creates a new client for CalculatorService
49 | /// The channel to use to make remote calls.
50 | public CalculatorServiceClient(grpc::ChannelBase channel) : base(channel)
51 | {
52 | }
53 | /// Creates a new client for CalculatorService that uses a custom CallInvoker.
54 | /// The callInvoker to use to make remote calls.
55 | public CalculatorServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
56 | {
57 | }
58 | /// Protected parameterless constructor to allow creation of test doubles.
59 | protected CalculatorServiceClient() : base()
60 | {
61 | }
62 | /// Protected constructor to allow creation of configured clients.
63 | /// The client configuration.
64 | protected CalculatorServiceClient(ClientBaseConfiguration configuration) : base(configuration)
65 | {
66 | }
67 |
68 | public virtual global::Calculator.SumResponse Sum(global::Calculator.SumRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
69 | {
70 | return Sum(request, new grpc::CallOptions(headers, deadline, cancellationToken));
71 | }
72 | public virtual global::Calculator.SumResponse Sum(global::Calculator.SumRequest request, grpc::CallOptions options)
73 | {
74 | return CallInvoker.BlockingUnaryCall(__Method_Sum, null, options, request);
75 | }
76 | public virtual grpc::AsyncUnaryCall SumAsync(global::Calculator.SumRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
77 | {
78 | return SumAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
79 | }
80 | public virtual grpc::AsyncUnaryCall SumAsync(global::Calculator.SumRequest request, grpc::CallOptions options)
81 | {
82 | return CallInvoker.AsyncUnaryCall(__Method_Sum, null, options, request);
83 | }
84 | /// Creates a new instance of client from given ClientBaseConfiguration.
85 | protected override CalculatorServiceClient NewInstance(ClientBaseConfiguration configuration)
86 | {
87 | return new CalculatorServiceClient(configuration);
88 | }
89 | }
90 |
91 | /// Creates service definition that can be registered with a server
92 | /// An object implementing the server-side handling logic.
93 | public static grpc::ServerServiceDefinition BindService(CalculatorServiceBase serviceImpl)
94 | {
95 | return grpc::ServerServiceDefinition.CreateBuilder()
96 | .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
97 | }
98 |
99 | /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
100 | /// Note: this method is part of an experimental API that can change or be removed without any prior notice.
101 | /// Service methods will be bound by calling AddMethod on this object.
102 | /// An object implementing the server-side handling logic.
103 | public static void BindService(grpc::ServiceBinderBase serviceBinder, CalculatorServiceBase serviceImpl)
104 | {
105 | serviceBinder.AddMethod(__Method_Sum, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Sum));
106 | }
107 |
108 | }
109 | }
110 | #endregion
111 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/client/models/CalculatorGrpc.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Generated by the protocol buffer compiler. DO NOT EDIT!
3 | // source: calculator.proto
4 | //
5 | // Original file comments:
6 | // definition for grpc services
7 | //
8 | #pragma warning disable 0414, 1591
9 | #region Designer generated code
10 |
11 | using grpc = global::Grpc.Core;
12 |
13 | namespace Calculator {
14 | public static partial class CalculatorService
15 | {
16 | static readonly string __ServiceName = "calculator.CalculatorService";
17 |
18 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
19 | static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
20 | {
21 | #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
22 | if (message is global::Google.Protobuf.IBufferMessage)
23 | {
24 | context.SetPayloadLength(message.CalculateSize());
25 | global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
26 | context.Complete();
27 | return;
28 | }
29 | #endif
30 | context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
31 | }
32 |
33 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
34 | static class __Helper_MessageCache
35 | {
36 | public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
37 | }
38 |
39 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
40 | static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage
41 | {
42 | #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
43 | if (__Helper_MessageCache.IsBufferMessage)
44 | {
45 | return parser.ParseFrom(context.PayloadAsReadOnlySequence());
46 | }
47 | #endif
48 | return parser.ParseFrom(context.PayloadAsNewBuffer());
49 | }
50 |
51 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
52 | static readonly grpc::Marshaller __Marshaller_calculator_SumRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Calculator.SumRequest.Parser));
53 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
54 | static readonly grpc::Marshaller __Marshaller_calculator_SumResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Calculator.SumResponse.Parser));
55 |
56 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
57 | static readonly grpc::Method __Method_Sum = new grpc::Method(
58 | grpc::MethodType.Unary,
59 | __ServiceName,
60 | "Sum",
61 | __Marshaller_calculator_SumRequest,
62 | __Marshaller_calculator_SumResponse);
63 |
64 | /// Service descriptor
65 | public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
66 | {
67 | get { return global::Calculator.CalculatorReflection.Descriptor.Services[0]; }
68 | }
69 |
70 | /// Base class for server-side implementations of CalculatorService
71 | [grpc::BindServiceMethod(typeof(CalculatorService), "BindService")]
72 | public abstract partial class CalculatorServiceBase
73 | {
74 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
75 | public virtual global::System.Threading.Tasks.Task Sum(global::Calculator.SumRequest request, grpc::ServerCallContext context)
76 | {
77 | throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
78 | }
79 |
80 | }
81 |
82 | /// Client for CalculatorService
83 | public partial class CalculatorServiceClient : grpc::ClientBase
84 | {
85 | /// Creates a new client for CalculatorService
86 | /// The channel to use to make remote calls.
87 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
88 | public CalculatorServiceClient(grpc::ChannelBase channel) : base(channel)
89 | {
90 | }
91 | /// Creates a new client for CalculatorService that uses a custom CallInvoker.
92 | /// The callInvoker to use to make remote calls.
93 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
94 | public CalculatorServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
95 | {
96 | }
97 | /// Protected parameterless constructor to allow creation of test doubles.
98 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
99 | protected CalculatorServiceClient() : base()
100 | {
101 | }
102 | /// Protected constructor to allow creation of configured clients.
103 | /// The client configuration.
104 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
105 | protected CalculatorServiceClient(ClientBaseConfiguration configuration) : base(configuration)
106 | {
107 | }
108 |
109 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
110 | public virtual global::Calculator.SumResponse Sum(global::Calculator.SumRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
111 | {
112 | return Sum(request, new grpc::CallOptions(headers, deadline, cancellationToken));
113 | }
114 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
115 | public virtual global::Calculator.SumResponse Sum(global::Calculator.SumRequest request, grpc::CallOptions options)
116 | {
117 | return CallInvoker.BlockingUnaryCall(__Method_Sum, null, options, request);
118 | }
119 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
120 | public virtual grpc::AsyncUnaryCall SumAsync(global::Calculator.SumRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
121 | {
122 | return SumAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
123 | }
124 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
125 | public virtual grpc::AsyncUnaryCall SumAsync(global::Calculator.SumRequest request, grpc::CallOptions options)
126 | {
127 | return CallInvoker.AsyncUnaryCall(__Method_Sum, null, options, request);
128 | }
129 | /// Creates a new instance of client from given ClientBaseConfiguration.
130 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
131 | protected override CalculatorServiceClient NewInstance(ClientBaseConfiguration configuration)
132 | {
133 | return new CalculatorServiceClient(configuration);
134 | }
135 | }
136 |
137 | /// Creates service definition that can be registered with a server
138 | /// An object implementing the server-side handling logic.
139 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
140 | public static grpc::ServerServiceDefinition BindService(CalculatorServiceBase serviceImpl)
141 | {
142 | return grpc::ServerServiceDefinition.CreateBuilder()
143 | .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
144 | }
145 |
146 | /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
147 | /// Note: this method is part of an experimental API that can change or be removed without any prior notice.
148 | /// Service methods will be bound by calling AddMethod on this object.
149 | /// An object implementing the server-side handling logic.
150 | [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
151 | public static void BindService(grpc::ServiceBinderBase serviceBinder, CalculatorServiceBase serviceImpl)
152 | {
153 | serviceBinder.AddMethod(__Method_Sum, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Sum));
154 | }
155 |
156 | }
157 | }
158 | #endregion
159 |
--------------------------------------------------------------------------------
/server/models/Calculator.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Generated by the protocol buffer compiler. DO NOT EDIT!
3 | // source: calculator.proto
4 | //
5 | #pragma warning disable 1591, 0612, 3021
6 | #region Designer generated code
7 |
8 | using pb = global::Google.Protobuf;
9 | using pbc = global::Google.Protobuf.Collections;
10 | using pbr = global::Google.Protobuf.Reflection;
11 | using scg = global::System.Collections.Generic;
12 | namespace Calculator {
13 |
14 | /// Holder for reflection information generated from calculator.proto
15 | public static partial class CalculatorReflection {
16 |
17 | #region Descriptor
18 | /// File descriptor for calculator.proto
19 | public static pbr::FileDescriptor Descriptor {
20 | get { return descriptor; }
21 | }
22 | private static pbr::FileDescriptor descriptor;
23 |
24 | static CalculatorReflection() {
25 | byte[] descriptorData = global::System.Convert.FromBase64String(
26 | string.Concat(
27 | "ChBjYWxjdWxhdG9yLnByb3RvEgpjYWxjdWxhdG9yIiIKClN1bVJlcXVlc3QS",
28 | "CQoBYRgBIAEoBRIJCgFiGAIgASgFIh0KC1N1bVJlc3BvbnNlEg4KBnJlc3Vs",
29 | "dBgBIAEoBTJNChFDYWxjdWxhdG9yU2VydmljZRI4CgNTdW0SFi5jYWxjdWxh",
30 | "dG9yLlN1bVJlcXVlc3QaFy5jYWxjdWxhdG9yLlN1bVJlc3BvbnNlIgBiBnBy",
31 | "b3RvMw=="));
32 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
33 | new pbr::FileDescriptor[] { },
34 | new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
35 | new pbr::GeneratedClrTypeInfo(typeof(global::Calculator.SumRequest), global::Calculator.SumRequest.Parser, new[]{ "A", "B" }, null, null, null),
36 | new pbr::GeneratedClrTypeInfo(typeof(global::Calculator.SumResponse), global::Calculator.SumResponse.Parser, new[]{ "Result" }, null, null, null)
37 | }));
38 | }
39 | #endregion
40 |
41 | }
42 | #region Messages
43 | public sealed partial class SumRequest : pb::IMessage {
44 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SumRequest());
45 | private pb::UnknownFieldSet _unknownFields;
46 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
47 | public static pb::MessageParser Parser { get { return _parser; } }
48 |
49 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
50 | public static pbr::MessageDescriptor Descriptor {
51 | get { return global::Calculator.CalculatorReflection.Descriptor.MessageTypes[0]; }
52 | }
53 |
54 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
55 | pbr::MessageDescriptor pb::IMessage.Descriptor {
56 | get { return Descriptor; }
57 | }
58 |
59 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
60 | public SumRequest() {
61 | OnConstruction();
62 | }
63 |
64 | partial void OnConstruction();
65 |
66 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
67 | public SumRequest(SumRequest other) : this() {
68 | a_ = other.a_;
69 | b_ = other.b_;
70 | _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
71 | }
72 |
73 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
74 | public SumRequest Clone() {
75 | return new SumRequest(this);
76 | }
77 |
78 | /// Field number for the "a" field.
79 | public const int AFieldNumber = 1;
80 | private int a_;
81 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
82 | public int A {
83 | get { return a_; }
84 | set {
85 | a_ = value;
86 | }
87 | }
88 |
89 | /// Field number for the "b" field.
90 | public const int BFieldNumber = 2;
91 | private int b_;
92 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
93 | public int B {
94 | get { return b_; }
95 | set {
96 | b_ = value;
97 | }
98 | }
99 |
100 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
101 | public override bool Equals(object other) {
102 | return Equals(other as SumRequest);
103 | }
104 |
105 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
106 | public bool Equals(SumRequest other) {
107 | if (ReferenceEquals(other, null)) {
108 | return false;
109 | }
110 | if (ReferenceEquals(other, this)) {
111 | return true;
112 | }
113 | if (A != other.A) return false;
114 | if (B != other.B) return false;
115 | return Equals(_unknownFields, other._unknownFields);
116 | }
117 |
118 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
119 | public override int GetHashCode() {
120 | int hash = 1;
121 | if (A != 0) hash ^= A.GetHashCode();
122 | if (B != 0) hash ^= B.GetHashCode();
123 | if (_unknownFields != null) {
124 | hash ^= _unknownFields.GetHashCode();
125 | }
126 | return hash;
127 | }
128 |
129 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
130 | public override string ToString() {
131 | return pb::JsonFormatter.ToDiagnosticString(this);
132 | }
133 |
134 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
135 | public void WriteTo(pb::CodedOutputStream output) {
136 | if (A != 0) {
137 | output.WriteRawTag(8);
138 | output.WriteInt32(A);
139 | }
140 | if (B != 0) {
141 | output.WriteRawTag(16);
142 | output.WriteInt32(B);
143 | }
144 | if (_unknownFields != null) {
145 | _unknownFields.WriteTo(output);
146 | }
147 | }
148 |
149 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
150 | public int CalculateSize() {
151 | int size = 0;
152 | if (A != 0) {
153 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(A);
154 | }
155 | if (B != 0) {
156 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(B);
157 | }
158 | if (_unknownFields != null) {
159 | size += _unknownFields.CalculateSize();
160 | }
161 | return size;
162 | }
163 |
164 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
165 | public void MergeFrom(SumRequest other) {
166 | if (other == null) {
167 | return;
168 | }
169 | if (other.A != 0) {
170 | A = other.A;
171 | }
172 | if (other.B != 0) {
173 | B = other.B;
174 | }
175 | _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
176 | }
177 |
178 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
179 | public void MergeFrom(pb::CodedInputStream input) {
180 | uint tag;
181 | while ((tag = input.ReadTag()) != 0) {
182 | switch(tag) {
183 | default:
184 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
185 | break;
186 | case 8: {
187 | A = input.ReadInt32();
188 | break;
189 | }
190 | case 16: {
191 | B = input.ReadInt32();
192 | break;
193 | }
194 | }
195 | }
196 | }
197 |
198 | }
199 |
200 | public sealed partial class SumResponse : pb::IMessage {
201 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SumResponse());
202 | private pb::UnknownFieldSet _unknownFields;
203 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
204 | public static pb::MessageParser Parser { get { return _parser; } }
205 |
206 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
207 | public static pbr::MessageDescriptor Descriptor {
208 | get { return global::Calculator.CalculatorReflection.Descriptor.MessageTypes[1]; }
209 | }
210 |
211 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
212 | pbr::MessageDescriptor pb::IMessage.Descriptor {
213 | get { return Descriptor; }
214 | }
215 |
216 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
217 | public SumResponse() {
218 | OnConstruction();
219 | }
220 |
221 | partial void OnConstruction();
222 |
223 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
224 | public SumResponse(SumResponse other) : this() {
225 | result_ = other.result_;
226 | _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
227 | }
228 |
229 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
230 | public SumResponse Clone() {
231 | return new SumResponse(this);
232 | }
233 |
234 | /// Field number for the "result" field.
235 | public const int ResultFieldNumber = 1;
236 | private int result_;
237 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
238 | public int Result {
239 | get { return result_; }
240 | set {
241 | result_ = value;
242 | }
243 | }
244 |
245 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
246 | public override bool Equals(object other) {
247 | return Equals(other as SumResponse);
248 | }
249 |
250 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
251 | public bool Equals(SumResponse other) {
252 | if (ReferenceEquals(other, null)) {
253 | return false;
254 | }
255 | if (ReferenceEquals(other, this)) {
256 | return true;
257 | }
258 | if (Result != other.Result) return false;
259 | return Equals(_unknownFields, other._unknownFields);
260 | }
261 |
262 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
263 | public override int GetHashCode() {
264 | int hash = 1;
265 | if (Result != 0) hash ^= Result.GetHashCode();
266 | if (_unknownFields != null) {
267 | hash ^= _unknownFields.GetHashCode();
268 | }
269 | return hash;
270 | }
271 |
272 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
273 | public override string ToString() {
274 | return pb::JsonFormatter.ToDiagnosticString(this);
275 | }
276 |
277 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
278 | public void WriteTo(pb::CodedOutputStream output) {
279 | if (Result != 0) {
280 | output.WriteRawTag(8);
281 | output.WriteInt32(Result);
282 | }
283 | if (_unknownFields != null) {
284 | _unknownFields.WriteTo(output);
285 | }
286 | }
287 |
288 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
289 | public int CalculateSize() {
290 | int size = 0;
291 | if (Result != 0) {
292 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Result);
293 | }
294 | if (_unknownFields != null) {
295 | size += _unknownFields.CalculateSize();
296 | }
297 | return size;
298 | }
299 |
300 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
301 | public void MergeFrom(SumResponse other) {
302 | if (other == null) {
303 | return;
304 | }
305 | if (other.Result != 0) {
306 | Result = other.Result;
307 | }
308 | _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
309 | }
310 |
311 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
312 | public void MergeFrom(pb::CodedInputStream input) {
313 | uint tag;
314 | while ((tag = input.ReadTag()) != 0) {
315 | switch(tag) {
316 | default:
317 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
318 | break;
319 | case 8: {
320 | Result = input.ReadInt32();
321 | break;
322 | }
323 | }
324 | }
325 | }
326 |
327 | }
328 |
329 | #endregion
330 |
331 | }
332 |
333 | #endregion Designer generated code
334 |
--------------------------------------------------------------------------------
/client/models/Calculator.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Generated by the protocol buffer compiler. DO NOT EDIT!
3 | // source: calculator.proto
4 | //
5 | #pragma warning disable 1591, 0612, 3021
6 | #region Designer generated code
7 |
8 | using pb = global::Google.Protobuf;
9 | using pbc = global::Google.Protobuf.Collections;
10 | using pbr = global::Google.Protobuf.Reflection;
11 | using scg = global::System.Collections.Generic;
12 | namespace Calculator {
13 |
14 | /// Holder for reflection information generated from calculator.proto
15 | public static partial class CalculatorReflection {
16 |
17 | #region Descriptor
18 | /// File descriptor for calculator.proto
19 | public static pbr::FileDescriptor Descriptor {
20 | get { return descriptor; }
21 | }
22 | private static pbr::FileDescriptor descriptor;
23 |
24 | static CalculatorReflection() {
25 | byte[] descriptorData = global::System.Convert.FromBase64String(
26 | string.Concat(
27 | "ChBjYWxjdWxhdG9yLnByb3RvEgpjYWxjdWxhdG9yIiIKClN1bVJlcXVlc3QS",
28 | "CQoBYRgBIAEoBRIJCgFiGAIgASgFIh0KC1N1bVJlc3BvbnNlEg4KBnJlc3Vs",
29 | "dBgBIAEoBTJNChFDYWxjdWxhdG9yU2VydmljZRI4CgNTdW0SFi5jYWxjdWxh",
30 | "dG9yLlN1bVJlcXVlc3QaFy5jYWxjdWxhdG9yLlN1bVJlc3BvbnNlIgBiBnBy",
31 | "b3RvMw=="));
32 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
33 | new pbr::FileDescriptor[] { },
34 | new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
35 | new pbr::GeneratedClrTypeInfo(typeof(global::Calculator.SumRequest), global::Calculator.SumRequest.Parser, new[]{ "A", "B" }, null, null, null, null),
36 | new pbr::GeneratedClrTypeInfo(typeof(global::Calculator.SumResponse), global::Calculator.SumResponse.Parser, new[]{ "Result" }, null, null, null, null)
37 | }));
38 | }
39 | #endregion
40 |
41 | }
42 | #region Messages
43 | public sealed partial class SumRequest : pb::IMessage
44 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
45 | , pb::IBufferMessage
46 | #endif
47 | {
48 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SumRequest());
49 | private pb::UnknownFieldSet _unknownFields;
50 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
51 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
52 | public static pb::MessageParser Parser { get { return _parser; } }
53 |
54 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
55 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
56 | public static pbr::MessageDescriptor Descriptor {
57 | get { return global::Calculator.CalculatorReflection.Descriptor.MessageTypes[0]; }
58 | }
59 |
60 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
61 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
62 | pbr::MessageDescriptor pb::IMessage.Descriptor {
63 | get { return Descriptor; }
64 | }
65 |
66 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
67 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
68 | public SumRequest() {
69 | OnConstruction();
70 | }
71 |
72 | partial void OnConstruction();
73 |
74 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
75 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
76 | public SumRequest(SumRequest other) : this() {
77 | a_ = other.a_;
78 | b_ = other.b_;
79 | _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
80 | }
81 |
82 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
83 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
84 | public SumRequest Clone() {
85 | return new SumRequest(this);
86 | }
87 |
88 | /// Field number for the "a" field.
89 | public const int AFieldNumber = 1;
90 | private int a_;
91 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
92 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
93 | public int A {
94 | get { return a_; }
95 | set {
96 | a_ = value;
97 | }
98 | }
99 |
100 | /// Field number for the "b" field.
101 | public const int BFieldNumber = 2;
102 | private int b_;
103 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
104 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
105 | public int B {
106 | get { return b_; }
107 | set {
108 | b_ = value;
109 | }
110 | }
111 |
112 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
113 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
114 | public override bool Equals(object other) {
115 | return Equals(other as SumRequest);
116 | }
117 |
118 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
119 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
120 | public bool Equals(SumRequest other) {
121 | if (ReferenceEquals(other, null)) {
122 | return false;
123 | }
124 | if (ReferenceEquals(other, this)) {
125 | return true;
126 | }
127 | if (A != other.A) return false;
128 | if (B != other.B) return false;
129 | return Equals(_unknownFields, other._unknownFields);
130 | }
131 |
132 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
133 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
134 | public override int GetHashCode() {
135 | int hash = 1;
136 | if (A != 0) hash ^= A.GetHashCode();
137 | if (B != 0) hash ^= B.GetHashCode();
138 | if (_unknownFields != null) {
139 | hash ^= _unknownFields.GetHashCode();
140 | }
141 | return hash;
142 | }
143 |
144 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
145 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
146 | public override string ToString() {
147 | return pb::JsonFormatter.ToDiagnosticString(this);
148 | }
149 |
150 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
151 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
152 | public void WriteTo(pb::CodedOutputStream output) {
153 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
154 | output.WriteRawMessage(this);
155 | #else
156 | if (A != 0) {
157 | output.WriteRawTag(8);
158 | output.WriteInt32(A);
159 | }
160 | if (B != 0) {
161 | output.WriteRawTag(16);
162 | output.WriteInt32(B);
163 | }
164 | if (_unknownFields != null) {
165 | _unknownFields.WriteTo(output);
166 | }
167 | #endif
168 | }
169 |
170 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
171 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
172 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
173 | void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
174 | if (A != 0) {
175 | output.WriteRawTag(8);
176 | output.WriteInt32(A);
177 | }
178 | if (B != 0) {
179 | output.WriteRawTag(16);
180 | output.WriteInt32(B);
181 | }
182 | if (_unknownFields != null) {
183 | _unknownFields.WriteTo(ref output);
184 | }
185 | }
186 | #endif
187 |
188 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
189 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
190 | public int CalculateSize() {
191 | int size = 0;
192 | if (A != 0) {
193 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(A);
194 | }
195 | if (B != 0) {
196 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(B);
197 | }
198 | if (_unknownFields != null) {
199 | size += _unknownFields.CalculateSize();
200 | }
201 | return size;
202 | }
203 |
204 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
205 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
206 | public void MergeFrom(SumRequest other) {
207 | if (other == null) {
208 | return;
209 | }
210 | if (other.A != 0) {
211 | A = other.A;
212 | }
213 | if (other.B != 0) {
214 | B = other.B;
215 | }
216 | _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
217 | }
218 |
219 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
220 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
221 | public void MergeFrom(pb::CodedInputStream input) {
222 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
223 | input.ReadRawMessage(this);
224 | #else
225 | uint tag;
226 | while ((tag = input.ReadTag()) != 0) {
227 | switch(tag) {
228 | default:
229 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
230 | break;
231 | case 8: {
232 | A = input.ReadInt32();
233 | break;
234 | }
235 | case 16: {
236 | B = input.ReadInt32();
237 | break;
238 | }
239 | }
240 | }
241 | #endif
242 | }
243 |
244 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
245 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
246 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
247 | void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
248 | uint tag;
249 | while ((tag = input.ReadTag()) != 0) {
250 | switch(tag) {
251 | default:
252 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
253 | break;
254 | case 8: {
255 | A = input.ReadInt32();
256 | break;
257 | }
258 | case 16: {
259 | B = input.ReadInt32();
260 | break;
261 | }
262 | }
263 | }
264 | }
265 | #endif
266 |
267 | }
268 |
269 | public sealed partial class SumResponse : pb::IMessage
270 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
271 | , pb::IBufferMessage
272 | #endif
273 | {
274 | private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SumResponse());
275 | private pb::UnknownFieldSet _unknownFields;
276 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
277 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
278 | public static pb::MessageParser Parser { get { return _parser; } }
279 |
280 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
281 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
282 | public static pbr::MessageDescriptor Descriptor {
283 | get { return global::Calculator.CalculatorReflection.Descriptor.MessageTypes[1]; }
284 | }
285 |
286 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
287 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
288 | pbr::MessageDescriptor pb::IMessage.Descriptor {
289 | get { return Descriptor; }
290 | }
291 |
292 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
293 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
294 | public SumResponse() {
295 | OnConstruction();
296 | }
297 |
298 | partial void OnConstruction();
299 |
300 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
301 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
302 | public SumResponse(SumResponse other) : this() {
303 | result_ = other.result_;
304 | _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
305 | }
306 |
307 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
308 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
309 | public SumResponse Clone() {
310 | return new SumResponse(this);
311 | }
312 |
313 | /// Field number for the "result" field.
314 | public const int ResultFieldNumber = 1;
315 | private int result_;
316 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
317 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
318 | public int Result {
319 | get { return result_; }
320 | set {
321 | result_ = value;
322 | }
323 | }
324 |
325 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
326 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
327 | public override bool Equals(object other) {
328 | return Equals(other as SumResponse);
329 | }
330 |
331 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
332 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
333 | public bool Equals(SumResponse other) {
334 | if (ReferenceEquals(other, null)) {
335 | return false;
336 | }
337 | if (ReferenceEquals(other, this)) {
338 | return true;
339 | }
340 | if (Result != other.Result) return false;
341 | return Equals(_unknownFields, other._unknownFields);
342 | }
343 |
344 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
345 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
346 | public override int GetHashCode() {
347 | int hash = 1;
348 | if (Result != 0) hash ^= Result.GetHashCode();
349 | if (_unknownFields != null) {
350 | hash ^= _unknownFields.GetHashCode();
351 | }
352 | return hash;
353 | }
354 |
355 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
356 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
357 | public override string ToString() {
358 | return pb::JsonFormatter.ToDiagnosticString(this);
359 | }
360 |
361 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
362 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
363 | public void WriteTo(pb::CodedOutputStream output) {
364 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
365 | output.WriteRawMessage(this);
366 | #else
367 | if (Result != 0) {
368 | output.WriteRawTag(8);
369 | output.WriteInt32(Result);
370 | }
371 | if (_unknownFields != null) {
372 | _unknownFields.WriteTo(output);
373 | }
374 | #endif
375 | }
376 |
377 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
378 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
379 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
380 | void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
381 | if (Result != 0) {
382 | output.WriteRawTag(8);
383 | output.WriteInt32(Result);
384 | }
385 | if (_unknownFields != null) {
386 | _unknownFields.WriteTo(ref output);
387 | }
388 | }
389 | #endif
390 |
391 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
392 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
393 | public int CalculateSize() {
394 | int size = 0;
395 | if (Result != 0) {
396 | size += 1 + pb::CodedOutputStream.ComputeInt32Size(Result);
397 | }
398 | if (_unknownFields != null) {
399 | size += _unknownFields.CalculateSize();
400 | }
401 | return size;
402 | }
403 |
404 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
405 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
406 | public void MergeFrom(SumResponse other) {
407 | if (other == null) {
408 | return;
409 | }
410 | if (other.Result != 0) {
411 | Result = other.Result;
412 | }
413 | _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
414 | }
415 |
416 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
417 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
418 | public void MergeFrom(pb::CodedInputStream input) {
419 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
420 | input.ReadRawMessage(this);
421 | #else
422 | uint tag;
423 | while ((tag = input.ReadTag()) != 0) {
424 | switch(tag) {
425 | default:
426 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
427 | break;
428 | case 8: {
429 | Result = input.ReadInt32();
430 | break;
431 | }
432 | }
433 | }
434 | #endif
435 | }
436 |
437 | #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
438 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
439 | [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
440 | void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
441 | uint tag;
442 | while ((tag = input.ReadTag()) != 0) {
443 | switch(tag) {
444 | default:
445 | _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
446 | break;
447 | case 8: {
448 | Result = input.ReadInt32();
449 | break;
450 | }
451 | }
452 | }
453 | }
454 | #endif
455 |
456 | }
457 |
458 | #endregion
459 |
460 | }
461 |
462 | #endregion Designer generated code
463 |
--------------------------------------------------------------------------------