Files
TenWholeYears.Server/RecNet.Application/Profiles/NameGenerator.cs

17 lines
592 B
C#

using RecNet.Application.Common.Interfaces;
using RecNet.Domain.Entities.Profiles.Names;
namespace RecNet.Application.Profiles;
public class NameGenerator(IConfigService configService)
{
public async Task<string> GenerateAsync(CancellationToken ct = default)
{
var config = await configService.GetAsync("Profiles:NameGen", DefaultNameGenConfig.Value, ct);
var adjective = config.Adjectives[Random.Shared.Next(config.Adjectives.Count)];
var noun = config.Nouns[Random.Shared.Next(config.Nouns.Count)];
return $"{adjective}{noun}";
}
}