views:

157

answers:

1

I am extending my Object Property Value Diff but I realized if an object has too many properties I may not want to diff them all. So I came up with the

public class IgnorePropertyDiffAttribute : System.Attribute
{
}

so that I can mark the properties I want the diff to ignore. However I don’t want to pollute my domain object with [IgnorePropertyDiff].

public class Role
{
    [IgnorePropertyDiff]
    public String Description { set; get; }
    public Double Salary { set; get; }
    public Boolean HasBonus { set; get; }
}

My question is that is it possible to dynamically inject the [IgnorePropertyDiff] using IoC like Ninject or other IoC? If I sound like an completely idiot please execuse me as I am only a junior-mid level c# developer. Thanks in advance.

+2  A: 

Attributes are a compile-time feature, so no: you can't add them (or set values against them) using IoC.

Marc Gravell
thank you. that's what i thought but i wasn't 100% sure.
Jeffrey C