Skip to content

Instantly share code, notes, and snippets.

@dcomartin

dcomartin/vin.cs Secret

Created April 15, 2026 12:49
Show Gist options
  • Select an option

  • Save dcomartin/61db7ce0577a939ccdd3e8fa6761a900 to your computer and use it in GitHub Desktop.

Select an option

Save dcomartin/61db7ce0577a939ccdd3e8fa6761a900 to your computer and use it in GitHub Desktop.
public record RegisterVehicle(string Vin);
public class RegisterVehicleHandler
{
private readonly IVinDecoderService _vinDecoderService;
public RegisterVehicleHandler(IVinDecoderService vinDecoderService)
{
_vinDecoderService = vinDecoderService;
}
public async Task<string> Handle(RegisterVehicle command, CancellationToken cancellationToken)
{
var vinResult = await _vinDecoderService.Lookup(command.Vin, cancellationToken);
// Do something with the result... save in DB. Whatever.
return $"{vinResult.Year} {vinResult.Make} {vinResult.Model}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment