添加项目文件。

This commit is contained in:
2023-03-13 15:00:34 +08:00
parent 42bf06ca3e
commit 1d73df3235
1205 changed files with 185078 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
using JNPF.WebSockets;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// WebSocket服务集合拓展.
/// </summary>
public static class WebSocketServiceCollectionExtensions
{
public static IServiceCollection AddWebSocketManager(this IServiceCollection services)
{
services.AddTransient<WebSocketConnectionManager>();
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes().Where(t => t.BaseType == typeof(WebSocketHandler)))
.ToArray();
foreach (var type in types)
{
services.AddSingleton(type);
}
return services;
}
}