Cannot Ignore Protected Property
See original GitHub issueFirst of all, great lib and great work!
The issue I’m having is as described. I cannot opt to ignore a property if that property is protected. In fact, I cannot do anything to a hidden property.
The method .Ignore() (and all others) only allows for an expression to be passed in.
That makes it dificult to handle hidden members.
My suggestion is that these methods have an overload with a string parameter (like EF does) to allow a property name to be passed in, like .Ignore("MyProtectedProperty") or .RuleFor<string>("MyProtectedProperty", f =>f.Random.Word()).
To work around this issue, I manage to get it working by using .RuleForType<TType>(Type, Func) after some try and error to get the types correct, however, if the type is shared between multiple properties, there is no way to configure the target property alone.
That’s all. Keep up the good work!
Thanks,
Cleverson Nascimento
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)

Top Related StackOverflow Question
Great work Nick! Thanks for keeping AutoBogus up to date! Also, thanks again for your help! If you need anything else, please don’t hesitate to let me know. 👍
Hey @SuricateCan and @bchavez,
I have just pushed v2.7.0 which upgrades to the latest version of Bogus and adds a string version of the skip config:
.WithSkip<Person>("Age");Nick.