GUID Generation
Guid generators in RCommon
Sequential Guid Generator
Configuration
// Configuration
builder.Services.AddRCommon()
.WithSequentialGuidGenerator(guid =>
guid.DefaultSequentialGuidType = SequentialGuidType.SequentialAsString);Implementation
public class CreateLighthouseProfileCommandHandler : IAppRequestHandler<CreateLighthouseProfileCommand, LighthouseProfileResponse>
{
private readonly IGuidGenerator _guidGenerator;
public CreateLighthouseProfileCommandHandler(IGuidGenerator guidGenerator)
{
_guidGenerator = guidGenerator;
}
public async Task<LighthouseProfileResponse> HandleAsync(CreateLighthouseProfileCommand request, CancellationToken cancellationToken)
{
LighthouseProfile profile = new LighthouseProfile(_guidGenerator.Create(), request.WebsiteUrl, request.CreatedByEmail);Simple Guid Generator
Configuration
Implementation
Last updated