Browse Source

removed the provider since it's useless now, fixed the build break. Forgot to rename in the sample AddScoped... to AddDiscordRestClient().

pull/1806/head
emorell96 4 years ago
parent
commit
b6ed3dd314
2 changed files with 1 additions and 35 deletions
  1. +1
    -1
      samples/05_simple_blazor_discord_login/Startup.cs
  2. +0
    -34
      src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs

+ 1
- 1
samples/05_simple_blazor_discord_login/Startup.cs View File

@@ -30,7 +30,7 @@ namespace _04_simple_blazor_discord_login
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddScopedDiscordRestClient();
services.AddDiscordRestClient();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.


+ 0
- 34
src/Discord.Net.Rest/Net/HttpClientFactoryClientProvider.cs View File

@@ -1,34 +0,0 @@
using Discord.Net.Rest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Discord.Rest.Net
{
/// <summary>
/// This RestClientProvider creates the IRestClient used when using an IHttpClientFactory.
/// </summary>
public class HttpClientFactoryRestClientProvider
{
public readonly RestClientProvider Instance;

private readonly IHttpClientFactory _httpClientFactory;

/// <summary>
/// Constructs the HttpClientFactoryRestClientProvider, the idea is to use this with DI so that the parameters gets fed with the right HttpClientFactory.
/// </summary>
/// <param name="httpClientFactory">This is the IHttpClientFactory used. It should be fed through DI.</param>
public HttpClientFactoryRestClientProvider(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;

Instance = url => new HttpClientFactoryRestClient(url, _httpClientFactory.CreateClient("HttpClientFactoryRestClientProvider"), useProxy: false);
}



}
}

Loading…
Cancel
Save