I'm following the Microsoft guide found here on how to added a named HTTPClient to my SQL Server with SQLCLR. It all seems straight forward once the HTTPClient is added and I've even got the code to add, but I cannot figure out WHERE this code is supposed to go:
services.AddHttpClient("github", c =>
{
c.BaseAddress = new Uri("https://api.github.com/");
// Github API versioning
c.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");
// Github requires a user-agent
c.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample");
});
Apparently this code is somehow supposed to end up in the Startup class. How it ends up there, I don't understand. I can't even find this class.
I tried adding this code to a C# script but of course it complains that it doesn't know what services is. I don't even know what it is, so I don't expect the SQL Server to know either...
Can someone point me in the right direction please? I'm completely stuck at this point.
EDIT
So I'm struggling because I've misunderstood the way a SQL Server is supposed to bridge a database and an external source. There needs to be a web app between them. The web app handles the HTTPClient, not the database....