【发布时间】:2009-01-09 03:52:44
【问题描述】:
我是extending my Object Property Value Diff,但我意识到如果一个对象有太多属性,我可能不想全部区分它们。所以我想出了
public class IgnorePropertyDiffAttribute : System.Attribute
{
}
以便我可以标记我希望差异忽略的属性。但是我不想用 [IgnorePropertyDiff] 污染我的域对象。
public class Role
{
[IgnorePropertyDiff]
public String Description { set; get; }
public Double Salary { set; get; }
public Boolean HasBonus { set; get; }
}
我的问题是,是否可以使用 IoC(如 Ninject 或其他 IoC)动态注入 [IgnorePropertyDiff]?如果我听起来像个白痴,请执行我,因为我只是一个初级中级 c# 开发人员。提前致谢。
【问题讨论】:
标签: c# reflection dependency-injection inversion-of-control attributes