public static IServiceCollection AddSlipService(this IServiceCollection serviceCollection, Action <SlipServiceSettings> setupAction) { SlipServiceSettings slipSettings = setupAction?.CreateTargetAndInvoke(); return(serviceCollection.AddSingleton <ISlipRepository>(new SlipRepository(slipSettings.SlipComponentsRepositoryPath)) .AddSingleton((sp) => TraceDecorator <ISlipService> .Create(new SlipService(sp.GetRequiredService <ISlipRepository>(), sp.GetRequiredService <ICatalogService>(), slipSettings)))); }
public SlipService(ISlipRepository slipRepository, ICatalogService catalogService, SlipServiceSettings slipSettings) { _slipRepository = slipRepository; _catalogService = catalogService; _slipSettings = slipSettings; _printDocument = new PrintDocument(); }