79277619

Date: 2024-12-13 08:34:29
Score: 2
Natty:
Report link

@Svyatoslav Danyliv

Thanks,Your solution has completely opened up my thinking。

But there is a small issue, the method of entityType.GetProperties() is sorted alphabetically,so it cannot export like this : BName ,AName

public class Test: BaseModel
{
    public string BName { get; set; }

    public string AName { get; set; }
}

because the basemodel's fileds have Column(Order = x) x=0 (...) x=100 so i resolve it at the last like this:

var columnOrder = property.GetColumnOrder();
if (!columnOrder.HasValue)
{
    property.SetColumnOrder(1);
}
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Svyatoslav
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Xt Yuan