init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace Kreta.Naplo.Domain.V3.Utility.ValidationAttributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class EnumToDescriptionAttribute : DescriptionAttribute
|
||||
{
|
||||
public override string Description => base.Description;
|
||||
|
||||
public EnumToDescriptionAttribute(string description, Type enumType)
|
||||
{
|
||||
DescriptionValue = description + " (" + GetEnumsFromGenerated(enumType) + ")";
|
||||
}
|
||||
|
||||
private string GetEnumsFromGenerated(Type enumType)
|
||||
{
|
||||
var enumNames = System.Enum.GetNames(enumType).ToList();
|
||||
return string.Join(", ", enumNames);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue