-
-
Notifications
You must be signed in to change notification settings - Fork 538
Open
Labels
Description
Description
I would like the ability to set/get Faker parameters for example by calling Faker.AddParameter(string, object) and Faker.GetParameter(string, object) so that it can be used in Faker.RuleFor() and Faker.Rules().
An example on how to do this was provided in #460 (comment) using extension methods and it would be awesome if the extension methods were officially implemented in the library as a builtin feature.
Similar features in other libraries
- Mapster https://github.com/MapsterMapper/Mapster/wiki/Setting-values#passing-run-time-value.
- FluentValidation https://docs.fluentvalidation.net/en/latest/advanced.html#root-context-data
LINQPad Code Example
An example was provided in #460 (comment).
What alternatives have you considered?
- Use the extension methods documented in Passing Parameters for Rules #460 (comment).
- Inherit from Faker.
- Wrap Faker in a method.
Could you help with a pull-request?
No