Some tips about my project:
-ASP.NET MVC 5.2.7 -Entity Framework 6.4 (Database First) -EPPlus 4
Requirements:
-Develop a simple and clean way to send IEnumerables from querys to Excel.
The solution:
-EPPlus and LoadFromCollection function.
The problem:
-Column headers in Excel keep same text as DB column names, and user don't like that.
-I set attribute DisplayName to set headers text, it seems it´s the only valid attribute for this matter.
-As I've configured my EF model Database first, if I set attributes to model, they're erased when model is updated.
-Then I tried metadata solution to set attributes to EF models, works great for validation. But for DisplayName, Visual Studio throws this error in compilation: Attribute 'DisplayName' is not valid on this declaration type. It is only valid on 'class, method, property, indexer, event' declarations.
I've tried to find a solution but I couldn't. Maybe it's something so simple anyone needed to ask before, although I don't know how to achieve that, may anyone help me?
How can I customize column headers text using LoadFromCollection and EF in DB First configuration?
Thanks in advance!