Closed McPhale closed 5 years ago
Hi @McPhale
Currently, the way you are doing it is the way I suggest. I am however working on some enhancements that will allow you apply these rules more generically either in your own IAutoBinder
instance or via a new Override
mechanism I am adding. This will essentially allow you to intercept the generate process for a given type or name (e.g. reflected property name) and provide the value yourself.
Furthermore, this provides an opportunity to add a library that compliments the main AutoBogus
core whereby common mappings like Name, Email, Address, etc. can be resolved without any further configuration on the consuming code. Essentially, it is a set of conventions use to generate types and will be available as a separate NuGet Package.
I am hoping to push all this out in the next few weeks.
Nick.
Hey friends,
I'm not sure if this helps, but don't forget you can generate an email list like this too:
(using latest Bogus v26.0.2)
var emailList = Enumerable.Range(0, 10)
.Select(i => new Person(seed:i))
.Select(p => p.Email);
emailList.Dump();
and if determinism isn't important, you can reduce it even more:
var emailList = Enumerable.Range(0, 10)
.Select(i => new Person().Email);
BTW, keep up the amazing work you're doing here Nick! I'm always excited to see the progress you're making here!
Also, super big thank you for your AutoBogus
work and contribution to the community! I think life would be a lot harder for developers without it!
Thanks guys! Makes sense to me
There's probably something pretty basic I'm missing here, apologies in advance :)
Let's say I want to generate a list of 10 strings formatted as email addresses. Is there an optimum way of doing this?