Преглед на файлове

refactor and remove files.

master
Savorboard преди 7 години
родител
ревизия
7766d408c4
променени са 3 файла, в които са добавени 0 реда и са изтрити 79 реда
  1. +0
    -14
      src/DotNetCore.CAP/Dashboard/GatewayProxy/HostAndPort.cs
  2. +0
    -56
      src/DotNetCore.CAP/Dashboard/GatewayProxy/IRequestScopedDataRepository.HttpData.cs
  3. +0
    -9
      src/DotNetCore.CAP/Dashboard/GatewayProxy/IRequestScopedDataRepository.cs

+ 0
- 14
src/DotNetCore.CAP/Dashboard/GatewayProxy/HostAndPort.cs Целия файл

@@ -1,14 +0,0 @@
namespace DotNetCore.CAP.Dashboard.GatewayProxy
{
public class HostAndPort
{
public HostAndPort(string downstreamHost, int downstreamPort)
{
DownstreamHost = downstreamHost?.Trim('/');
DownstreamPort = downstreamPort;
}

public string DownstreamHost { get; private set; }
public int DownstreamPort { get; private set; }
}
}

+ 0
- 56
src/DotNetCore.CAP/Dashboard/GatewayProxy/IRequestScopedDataRepository.HttpData.cs Целия файл

@@ -1,56 +0,0 @@
using System;
using System.Collections.Concurrent;
using Microsoft.AspNetCore.Http;

namespace DotNetCore.CAP.Dashboard.GatewayProxy
{
public class HttpDataRepository : IRequestScopedDataRepository
{
private readonly IHttpContextAccessor _httpContextAccessor;

public HttpDataRepository(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}

public void Add<T>(string key, T value)
{
_httpContextAccessor.HttpContext.Items.Add(key, value);
}

public T Get<T>(string key)
{
object obj;

if (_httpContextAccessor.HttpContext.Items.TryGetValue(key, out obj))
{
return (T)obj;
}
throw new Exception($"Unable to find data for key: {key}");
}
}

public class ScopedDataRepository : IRequestScopedDataRepository
{
private readonly ConcurrentDictionary<string, object> dictionary = null;

public ScopedDataRepository()
{
dictionary = new ConcurrentDictionary<string, object>();
}

public void Add<T>(string key, T value)
{
dictionary.AddOrUpdate(key, value, (k, v) => value);
}

public T Get<T>(string key)
{
if (dictionary.TryGetValue(key, out object t))
{
return (T)t;
}
throw new Exception($"Unable to find data for key: {key}");
}
}
}

+ 0
- 9
src/DotNetCore.CAP/Dashboard/GatewayProxy/IRequestScopedDataRepository.cs Целия файл

@@ -1,9 +0,0 @@
namespace DotNetCore.CAP.Dashboard.GatewayProxy
{
public interface IRequestScopedDataRepository
{
void Add<T>(string key, T value);

T Get<T>(string key);
}
}

Зареждане…
Отказ
Запис