Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 19, 2024 20:58
Show Gist options
  • Save dcomartin/323f296b774d2a364ed98e321e0925ff to your computer and use it in GitHub Desktop.
Save dcomartin/323f296b774d2a364ed98e321e0925ff to your computer and use it in GitHub Desktop.
public sealed record DownloadableResource(
int Id,
int ProductId,
string DownloadUrl,
string DefaultDownloadFilename);
public sealed class ProductHandler2(ResourcesHelper2 _resourcesHelper)
{
public void DoStuff(Product product)
{
var downloadableResource = _resourcesHelper.GetDownloadable(product.Id);
// do stuff with downloadable resource
}
}
public sealed class ResourcesHelper2
{
public DownloadableResource? GetDownloadable(int productId)
{
// TODO: go fetch this from the DB or return null...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment