C#C
C#3y ago
Sonath

✅ Recommended way to handle null results from a repository GET action?

I'm learning .NET Core and in Java (yes, I did Java) I used to create custom exceptions to throw. The equivalent would be
var company = _repository.Company.GetCompany(companyId, trackChanges);
if (company is null)
    throw new CompanyNotFoundException(companyId);

Is this a good idea?
Was this page helpful?