Skip to content

Commit

Permalink
Fixing #939, wrong capitalizing for early bound
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Jul 31, 2023
1 parent 7dee1a9 commit 4e10d2b
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions FetchXmlBuilder/Converters/CSharpCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,15 +1129,15 @@ private string GetCodeAttribute(string entityname, string attributename, bool ad
case QExFlavorEnum.EarlyBound:
if (addentityprefix)
{
return GetCodeEntityPrefix(entityname) + "." + attribute.SchemaName;
return GetCodeEntityPrefix(entityname) + "." + attribute.CapitSchemaName(settings.QExFlavor);
}
return attribute.SchemaName;
return attribute.CapitSchemaName(settings.QExFlavor);

case QExFlavorEnum.LCGconstants:
return LCG.Extensions.GetEntityClass(entity, settings.LCG_Settings) + "." + LCG.Extensions.GetAttributeProperty(attribute, settings.LCG_Settings);

default:
return entity.SchemaName + "." + settings.EBG_AttributeLogicalNameClass + attribute.SchemaName;
return entity.SchemaName + "." + settings.EBG_AttributeLogicalNameClass + attribute.CapitSchemaName(settings.QExFlavor);
}
}
return "\"" + attributename + "\"";
Expand Down Expand Up @@ -1416,4 +1416,23 @@ internal enum AroundBy
Parentheses,
Braces
}
}

internal static class EBGExtensions
{
internal static string CapitSchemaName(this AttributeMetadata attribute, QExFlavorEnum flavor)
{
switch (flavor)
{
case QExFlavorEnum.EBGconstants:
case QExFlavorEnum.EarlyBound:
switch (attribute.SchemaName.ToLowerInvariant())
{
case "statecode": return "StateCode";
case "statuscode": return "StatusCode";
}
break;
}
return attribute.SchemaName;
}
}
}

0 comments on commit 4e10d2b

Please sign in to comment.