Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Currently (code in branch 1.8) avrogen generates properties in C# data classes 1:1 as they are defined in shema, what results for field named 'favorite_color' in code like following:
public string favorite_color {
get
set { this._favorite_color = value; }
}
In general property names should use PascalCasing (see: https://msdn.microsoft.com/en-us/library/ms229043.aspx) and correctly generated code would look like
public string FavoriteColor {
get { return this._favorite_color; }
set
{ this._favorite_color = value; }}
Potential change is rather minor:
.\avro\lang\csharp\src\apache\main\CodeGen\CodeGen.cs : 581
change
var mangledName = CodeGenUtil.Instance.Mangle(field.Name);
to
var mangledName = CodeGenUtil.Instance.Mangle(AsPropName(field.Name));
where AsPropName function may look like following
public string AsPropName(string name)
{ return Regex.Replace(name, @"^\S|_\S", match => match.Value.Replace("_","").ToUpper()); }Attachments
Issue Links
- is duplicated by
-
AVRO-2884 C# - Generated code naming conventions not compliant
- Resolved