Make ConnectionMetadata object,object dictionary
This commit is contained in:
parent
0e690d636f
commit
5f23231d9b
|
|
@ -6,11 +6,11 @@ namespace Microsoft.AspNetCore.Sockets
|
||||||
{
|
{
|
||||||
public class ConnectionMetadata
|
public class ConnectionMetadata
|
||||||
{
|
{
|
||||||
private ConcurrentDictionary<string, object> _metadata = new ConcurrentDictionary<string, object>();
|
private ConcurrentDictionary<object, object> _metadata = new ConcurrentDictionary<object, object>();
|
||||||
|
|
||||||
public Format Format { get; set; } = Format.Text;
|
public Format Format { get; set; } = Format.Text;
|
||||||
|
|
||||||
public object this[string key]
|
public object this[object key]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
@ -24,12 +24,12 @@ namespace Microsoft.AspNetCore.Sockets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetOrAdd<T>(string key, Func<string, T> factory)
|
public T GetOrAdd<T>(object key, Func<object, T> factory)
|
||||||
{
|
{
|
||||||
return (T)_metadata.GetOrAdd(key, k => factory(k));
|
return (T)_metadata.GetOrAdd(key, k => factory(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Get<T>(string key)
|
public T Get<T>(object key)
|
||||||
{
|
{
|
||||||
return (T)this[key];
|
return (T)this[key];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue