how to dynamically hydrate all properties #536
Unanswered
ismailmayat
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a complex class tree graph and was looking to autopopulate all properties with mock data. I have the following code
` var faker = AutoInferRules<IATA_AIDX_FlightLegNotifRQ>();
var flight = faker.Generate();
static Faker AutoInferRules() where T : class, new()
{
var faker = new Faker();
}
static List GenerateList() where T : class, new()
{
var faker = AutoInferRules();
return new List { faker.Generate() };
}`
I get an error on the line:
The error is
This makes sense, because the initial call is with T where T is IATA_AIDX_FlightLegNotifRQ what I am unsure of is how do I for the Expression Lambda instead of using T use the type of the class on the property which I have inferred and created a MakeGenericMethod call for.
Beta Was this translation helpful? Give feedback.
All reactions