Skip to content

Compono.BogusOptions.AddConvention(string,System.Func Bogus.Faker,string )

Compono.Bogus

Compono.BogusOptions

BogusOptions.AddConvention(string, Func\<Faker,string>) Method

Adds a custom exact-name convention: a member named exactly memberName resolves to generate's result, called against a request-local, context.DeriveSeed()-seeded Bogus.Faker - the same determinism contract every other value in this package follows. Validated and applied eagerly, immediately, against this BogusOptions instance's own accumulated state - not deferred to UseBogus(...) returning, and not detected across separate UseBogus(...) calls.

public void AddConvention(string memberName, System.Func<Bogus.Faker,string> generate);

Parameters

memberName System.String

The exact member name to match.

generate System.Func<Bogus.Faker,System.String>

Produces this member's value from a seeded Bogus.Faker.

Exceptions

System.ArgumentNullException
memberName or generate is null.

System.ArgumentException
memberName is empty or all-whitespace; or already configured as a built-in convention name, an existing alias, or an existing custom convention.