C# 属性为AttributeTarget的CustomAttribute将属性名称设置为字符串

C# 属性为AttributeTarget的CustomAttribute将属性名称设置为字符串,c#,.net,attributes,data-annotations,C#,.net,Attributes,Data Annotations,我想通过这种方式更改我的CustomAttribute用法,我使用它来引用自动完成下拉列表的搜索参数 现在: 但是我讨厌用字符串来定义实体属性,对我来说最好的解决方案是传递AttributeTarget属性而不写自由字符串 [EntitySearchDropBox(Id=MyTarget.Id,SearchColumns=MyTarget.Name)] public virtual class MyTarget MyTarget示例 public class MyTarget{ pub

我想通过这种方式更改我的
CustomAttribute
用法,我使用它来引用自动完成下拉列表的搜索参数

现在:

但是我讨厌用字符串来定义实体属性,对我来说最好的解决方案是传递
AttributeTarget
属性而不写自由字符串

[EntitySearchDropBox(Id=MyTarget.Id,SearchColumns=MyTarget.Name)]
public virtual class MyTarget
MyTarget示例

public class MyTarget{
    public int Id    {get; set;}
    public string Name  {get; set;}
    public string otherProperty { get; set; }
    //etc..
  }

隐马尔可夫模型。。。问题是什么?我想使用Intellisense在属性中填充数据,使用属性目标属性
public class MyTarget{
    public int Id    {get; set;}
    public string Name  {get; set;}
    public string otherProperty { get; set; }
    //etc..
  }