You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AutoBogus.Conventions allow aliases to be configured, expanding the property name targets associated with a given convention mapping. The following adds AnotherEmail and AlternateEmail property names as candidates for the Email generator:
AutoFaker.Configure(builder =>
{
builder.WithConventions(config =>
{
config.Email.Aliases(new [] { "AnotherEmail", "AlternateEmail" }); // Generates an email value for members named AnotherEmail & AlternateEmail
});
});
Feature Request
Allow Aliases with expression parameter.
Example:
AutoFaker.Configure(builder =>
{
builder.WithConventions(config =>
{
config.Email.Aliases<EntityName>(propName => propName.Contains("Email")); // Generates an email value for members with names containing Email
});
});
Work Around
builder.WithConventions(config =>
{
var emailProps = (from prop in typeof(<EntityType>).GetProperties() where prop.Name.Contains("Email") select prop.Name).ToArray();
config.Email.Aliases(emailProps);
})
I'm unsure how much overhead or complexity is involved with such a feature. However, this is quite useful when dealing with large flattened entities.
The text was updated successfully, but these errors were encountered:
c-conklin
changed the title
WithConventions aliases allow expression
[Enhancement] WithConventions aliases allow expression
Sep 26, 2022
AutoBogus.Conventions allow aliases to be configured, expanding the property name targets associated with a given convention mapping. The following adds
AnotherEmail
andAlternateEmail
property names as candidates for the Email generator:Feature Request
Allow Aliases with expression parameter.
Example:
Work Around
I'm unsure how much overhead or complexity is involved with such a feature. However, this is quite useful when dealing with large flattened entities.
The text was updated successfully, but these errors were encountered: