Is your feature request related to a problem? Please describe.
I'm using the Options service to bind hierarchical configuration data.
Suppose I have this class:
public class PersonOptions
{
public string Name { get; set; }
public int Age { get; set; }
public bool Foo { // <--- I want binder to ignore this
get {
// ... do stuff
}
}
public bool IgnoreMe => throw new Exception(); // <--- I want binder to ignore this
}
Because the Foo property is public, the binder runs it (which leads to various problems - why is it run?). My design requires it to be public, and I prefer not to change it to a method.
I hoped I could force the binder to ignore that property, e.g. using an attribute. I tried [JsonIgnore] but that didn't work.
Describe the solution you'd like
Please consider adding an attribute for this - if the property is decorated by that attribute, then don't try bind it, and don't run it.
Additional context
Thank you!
Is your feature request related to a problem? Please describe.
I'm using the Options service to bind hierarchical configuration data.
Suppose I have this class:
Because the
Fooproperty ispublic, the binder runs it (which leads to various problems - why is it run?). My design requires it to bepublic, and I prefer not to change it to a method.I hoped I could force the binder to ignore that property, e.g. using an attribute. I tried
[JsonIgnore]but that didn't work.Describe the solution you'd like
Please consider adding an attribute for this - if the property is decorated by that attribute, then don't try bind it, and don't run it.
Additional context
Thank you!