File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1+ # protobuf-net.Reflection
2+
3+ ## What is it?
4+
5+ > ProtoBuf DSL (proto2 / proto3) and descriptor tools for protobuf-net
6+
7+ It use to create .proto file for your service
8+
9+ ## Install?
10+
11+ Install [ ` protobuf-net.Reflection ` ] ( https://www.nuget.org/packages/protobuf-net.Reflection ) on your project
12+
13+ ## How use it?
14+
15+ After install change your service and add these lines:
16+
17+ ``` c#
18+ var generator = new SchemaGenerator
19+ {
20+ ProtoSyntax = ProtoSyntax .Proto3
21+ };
22+
23+ var schema = generator .GetSchema <ICalculator >(); // there is also a non-generic overload that takes Type
24+
25+ using (var writer = new System .IO .StreamWriter (" services.proto" ))
26+ {
27+ await writer .WriteAsync (schema );
28+ }
29+ ```
30+
31+ Now build your project. Your .proto file is exist on your bin/Debug or bin/Realase
32+
33+ Output example:
34+
35+ ``` c#
36+ syntax = " proto3" ;
37+ package Hyper ;
38+
39+ message MultiplyRequest {
40+ int32 X = 1 ;
41+ int32 Y = 2 ;
42+ }
43+ message MultiplyResult {
44+ int32 Result = 1 ;
45+ }
46+ service Calculator {
47+ rpc Multiply (MultiplyRequest ) returns (MultiplyResult );
48+ }
49+ ```
Original file line number Diff line number Diff line change 33- [ Getting Started] ( gettingstarted )
44- [ Configuration Options] ( configuration )
55- [ Package Layout] ( projects )
6+ - [ Create Proto File] ( createProtoFile )
67
78Other Content
89
9- - [ My talk on gRPC at the .NET Core Summer Event, 2019] ( talks/gRPC.pptx )
10+ - [ My talk on gRPC at the .NET Core Summer Event, 2019] ( talks/gRPC.pptx )
You can’t perform that action at this time.
0 commit comments