You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename Porticle.Grpc.GuidMapper to Porticle.Grpc.TypeMapper, update README, namespaces, and project references to reflect new functionality and naming. Add support for nullable enums and enhance documentation with examples and usage details.
A Roslyn-based post-processor for protoc-generated files that adds native Guid, Guid? and string? types in gRPC services.
3
+
A Roslyn-based post-processor for protoc-generated files that adds automatic mappings for
4
+
5
+
6
+
7
+
and vice versa.
4
8
5
9
## Build State
6
10
7
-
[](https://github.com/Machibuse/Porticle.CLDR/actions/workflows/release.yaml)
11
+
[](https://github.com/Machibuse/Porticle.CLDR/actions/workflows/release.yaml)
This library allows you to automatically convert PROTO string or StringValue fields to C# Guid, Guid? or string? types in protoc-generated files, enabling seamless integration of
16
-
GUIDs in your gRPC services without manual conversion
19
+
This library adds automatic conversion for:
20
+
21
+
- Protobuf string to C# Guid
22
+
- Protobuf google.Protobuf.StringValue to C# Guid?
23
+
- Protobuf google.Protobuf.StringValue to C# string?
24
+
- Protobuf optional enum to C# nullable enum
25
+
26
+
This Library adds a Roslyn Postprocessing zu the c# files generated by the protoc compiler.
27
+
Enabling seamless integration of Guid, Guid?, string? and nullable Enums in your gRPC services without manual conversion.
17
28
code.
18
29
19
30
## Installation
20
31
21
32
### Install the package via NuGet:
22
33
23
34
```powershell
24
-
dotnet add package Porticle.Grpc.GuidMapper
35
+
dotnet add package Porticle.Grpc.TypeMapper
25
36
```
26
37
27
38
After installing the Package, this Post build step ist dynamically added to your build.
@@ -33,7 +44,7 @@ After installing the Package, this Post build step ist dynamically added to your
// return null instead of default value when Has-Flag is false
225
+
returnnull;
226
+
}
227
+
}
228
+
set {
229
+
if(value==null) {
230
+
// Set hasflag to false when null is assigend
231
+
_hasBits0&=~1;
232
+
fooBar_=FooBarDefaultValue;
233
+
}
234
+
else
235
+
{
236
+
_hasBits0|=1;
237
+
fooBar_=value.Value;
238
+
}
239
+
}
151
240
}
152
241
```
153
242
154
-
## What currently is not Possible?
243
+
## What is currently not Possible?
155
244
156
245
- Mapping `repeated google.protobuf.StringValue` to `List<Guid?>` or `List<string?>` because grpc internally uses `RepeatedField<string>` instead of `RepeatedField<StringValue>`.
157
-
This may be a bug in protoc compiler, because it is also not possible to add `null` to `repeated google.protobuf.StringValue` because ther is a not null check in the Add function in `RepeatedField<T>`
246
+
This may be a bug in protoc compiler, because it is also not possible to add `null` to `repeated google.protobuf.StringValue` because there is a not null check in the Add function in `RepeatedField<T>`
158
247
159
248
- This Tool actually don't works when protoc / Grpc.Tools is compiled with GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
0 commit comments