فهرست منبع

enable overriding of property name using csharp_property_name

Jan Tattermusch 10 سال پیش
والد
کامیت
16a3e2b914
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      src/google/protobuf/compiler/csharp/csharp_helpers.cc

+ 3 - 1
src/google/protobuf/compiler/csharp/csharp_helpers.cc

@@ -253,7 +253,9 @@ std::string GetFieldConstantName(const FieldDescriptor* field) {
 }
 
 std::string GetPropertyName(const FieldDescriptor* descriptor) {
-  // TODO: fix this.
+  if (descriptor->options().has_csharp_property_name()) {
+    return descriptor->options().csharp_property_name();
+  }
   std::string property_name = UnderscoresToPascalCase(GetFieldName(descriptor));
   if (property_name == descriptor->containing_type()->name()) {
     property_name += "_";