bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.62k stars 491 forks source link

Rule set for dynamic schema #463

Open jvmlet opened 1 year ago

jvmlet commented 1 year ago

Is it possible to configure Bogus to generate amorphic data container according to dynamic schema ? I'm discovering arbitrary DB table and have System.Data.DataColumn[] as the discovered schema. From this schema I want to generate multiple System.Data.DataRow elements, that comply with the discovered schema :

var row = table.NewRow()
foreach(c: table.Columns){
row[name] = faker.RandomValueForType(c.DataType)
}

The above pseudo code would be great to have as generator/instantiator which can be shared. Thanks

ChristoWolf commented 10 months ago

Hi @jvmlet!

I guess something like this would be pretty easy to achieve using AutoBogus.