ef-enum-to-lookup icon indicating copy to clipboard operation
ef-enum-to-lookup copied to clipboard

Include Display/Description attribute data in a new column

Open sveinhelge opened this issue 10 years ago • 4 comments
trafficstars

Would like to have the ability to have Description as column.

The table would then look like this: Id Name Description

It could be implemented as a setting. var enumToLookup = new EnumToLookup(); enumToLookup.AddDescriptionColumn = true;

Since [Description("some name")] is used to override name we might need to add new attribute for this or redefine the usage.

sveinhelge avatar Jul 25 '15 12:07 sveinhelge

+1 good idea. This would make it possible to add more detail to things that access the db directly.

A pull request for this would be welcome.

I'll hold off actually releasing it till v2 as it's a significant change to the schema and would need some thought in how to handle the transition for existing installations.

I don't think I'd make it configurable, it would just always add it. Allowing the variation increases the complexity of what would have to be supported.

timabell avatar Jul 27 '15 10:07 timabell

Instead of using [Description("description")] could we use [System.ComponentModel.DataAnnotations.Display(Name="new name", Description="new description")]?

When using the ASP.NET MVC html helper @Html.EnumDropDownListFor(m=>m.MyEnum) it uses the Display("Name="") text to populate the drop down. (https://msdn.microsoft.com/en-us/library/system.web.mvc.html.selectextensions.enumdropdownlistfor(v=vs.118).aspx)

This could also allow the use of a Resource class as well

jasonp123 avatar Aug 15 '15 16:08 jasonp123

Great minds think alike @jasonp123 - take a look at the linked pull request discussion

timabell avatar Aug 15 '15 16:08 timabell

ha.. I'm new.. ignore me :-)

jasonp123 avatar Aug 15 '15 16:08 jasonp123