Ir al contenido

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.

Guías y Recetas — Printing

Patrones verificados compilados en .NET 10 (ImplicitUsings=disable, Nullable=enable).

using System;
using EricksonLopez.Printing;
using Microsoft.Extensions.DependencyInjection;
namespace Example.PrintingQuickStart;
public static class KeyedPrinterRecipe
{
public static ServiceProvider ConfigureStations()
{
var services = new ServiceCollection();
services.AddKeyedPooledTcpPrinter("front-desk", options =>
{
options.Host = "192.168.1.200";
options.Port = 9100;
options.TimeoutMs = 3000;
});
services.AddKeyedTcpPrinter("shipping-zpl", options =>
{
options.Host = "192.168.1.205";
options.Port = 9100;
options.TimeoutMs = 5000;
});
return services.BuildServiceProvider(
new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true });
}
}
using System;
using EricksonLopez.Printing;
namespace Example.PrintingQuickStart;
public static class ResilientPrinterRecipe
{
public static IPrinterClient CreateResilientClient()
{
var tcp = new TcpPrinterClient(new TcpPrinterClientOptions
{
Host = "192.168.1.200",
Port = 9100,
TimeoutMs = 5000,
});
return tcp.WithRetry(options =>
{
options.MaxRetries = 2;
options.InitialDelay = TimeSpan.FromMilliseconds(200);
});
}
}