是否有帮助我任何与此框架:(想,也许StructureMap可以帮我)填充性能饰有一个属性
每当我创建“MyClass的”的新实例或从IMyInterface的继承其他类我希望所有使用[MyPropertyAttribute]装饰的属性都使用属性中的属性Name来填充来自数据库或某些其他数据存储的值。
public class MyClass : IMyInterface
{
[MyPropertyAttribute("foo")]
public string Foo { get; set; }
}
[AttributeUsage(AttributeTargets.Property)]
public sealed class MyPropertyAttribute : System.Attribute
{
public string Name
{
get;
private set;
}
public MyPropertyAttribute(string name)
{
Name = name;
}
}