Skip to content
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Hi @antabuze!

\n

You should call the base constructor.
\nUsing your example:

\n
public sealed class CompanyFaker : Faker<Company>\n{\n    private CompanyFaker() : base(\"sv\") \n    {\n        RuleFor(c => c.Id, f => f.Random.Guid());\n        RuleFor(c => c.Name, f => f.Company.CompanyName());\n    }\n}
","upvoteCount":2,"url":"https://github.com/bchavez/Bogus/discussions/446#discussioncomment-7395122"}}}

Setting locale using Faker<T> inheritance. #446

Answered by ChristoWolf
manscronholm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @antabuze!

You should call the base constructor.
Using your example:

public sealed class CompanyFaker : Faker<Company>
{
    private CompanyFaker() : base("sv") 
    {
        RuleFor(c => c.Id, f => f.Random.Guid());
        RuleFor(c => c.Name, f => f.Company.CompanyName());
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@manscronholm
Comment options

Answer selected by bchavez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants