nickdodd79 / AutoBogus

A C# library complementing the Bogus generator by adding auto creation and population capabilities.
MIT License
423 stars 49 forks source link

Feature: skipping members should also work for inherited interfaces #94

Open ArnaudB88 opened 1 year ago

ArnaudB88 commented 1 year ago

I want to request a feature which allows you to declare members to skip of an interface. When a class inherits from that interface, the specified members to skip will also affect the class.

Code:

//Skip members by interface
AutoFaker.Configure(builder =>
{
  builder.WithSkip<IEntityBase>(x => x.CreatedBy);
}

//Instead of by class:
AutoFaker.Configure(builder =>
{
  builder
    .WithSkip<EntityFoo>(x => x.CreatedBy)
    .WithSkip<EntityBar>(x => x.CreatedBy)
    .WithSkip<EntityOther>(x => x.CreatedBy);
}

I will submit a PR for this