using Connected.Annotations; using Connected.Middleware; namespace Common.Numbering; [Priority(0)] internal sealed class DefaultProvider : MiddlewareComponent, INumberingProvider { public DefaultProvider(INumberingService numbering) { Numbering = numbering; } private INumberingService Numbering { get; } public async Task Invoke(NumberingCalculateArgs args) { if (Numbering is not NumberingService service) throw new InvalidCastException(nameof(NumberingService)); return await service.NextValue(args); } }