Closed ghisbo closed 3 years ago
Is the .GetColumnOrdinal() not giving the value? May need to have an incrementing variable as you go through properties (should be looped through in ordinal order) if that's the issue?
the .getColumnOrdinal does the job ( if i debug with console.writeline) but it seams to dissappear afterwards. I tried it with a counter as well and it gives the same.
Maybe use Handlebars built in {{@index}} notation? I'd also try property.GetColumnOrdinal().ToString()
Oh did you add property-ordinal to HbsEntityTypeTransformationService as well?
That was the problem. I added it there as well Thanks
public List<Dictionary<string, object>> TransformProperties(List<Dictionary<string, object>> properties)
{
var transformedProperties = new List<Dictionary<string, object>>();
foreach (var property in properties)
{
var propTypeInfo = new EntityPropertyInfo(property["property-type"] as string,
property["property-name"] as string,
(property["property-isnullable"] as bool?) == true);
var transformedProp = PropertyTransformer?.Invoke(propTypeInfo) ?? propTypeInfo;
transformedProperties.Add(new Dictionary<string, object>
{
{ "property-type", transformedProp.PropertyType },
{ "property-name", transformedProp.PropertyName },
{ "property-ordinal",property["property-ordinal"] },
{ "property-annotations", property["property-annotations"] },
{ "property-comment", property["property-comment"] },
{ "property-isnullable", transformedProp.PropertyIsNullable },
{ "nullable-reference-types", property["nullable-reference-types"] }
});
}
I am using EntityFrameworkCore.Scaffolding.Handlebars to generate xaml . it works ok ( i generate it as comment code in entity models)
except for 1 issue: i need the ordinal of the Column to generate the grid.
I modified the HbsCSharpEntityTypeGenerator GenerateProperties method by adding "property-ordinal", but it is not working ( always empty string)
in: HbsCSharpEntityTypeGenerator GenerateProperties
in Class.hbs: