~ruther/NosSmooth.Comms

ref: ae864d55d0a530321f0f9e9d9a2df6e6195e3bed NosSmooth.Comms/src/Local/NosSmooth.Comms.Local/Extensions/ServiceCollectionExtensions.cs -rw-r--r-- 1.3 KiB
ae864d55 — František Boháček feat: add RunClientRequest message with support of setting binding options 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
//  ServiceCollectionExtensions.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Extensions.DependencyInjection;
using NosSmooth.Comms.Core.Extensions;
using NosSmooth.Comms.Local.MessageResponders;
using NosSmooth.Core.Contracts;
using NosSmooth.Injector;
using NosSmooth.PacketSerializer.Extensions;

namespace NosSmooth.Comms.Local.Extensions;

/// <summary>
/// Extension methods for <see cref="IServiceCollection"/>.
/// </summary>
public static class ServiceCollectionExtensions
{
    /// <summary>
    /// Add <see cref="CommsInjector"/>.
    /// </summary>
    /// <param name="serviceCollection">The service ocllection.</param>
    /// <returns>The same service collection.</returns>
    public static IServiceCollection AddLocalComms(this IServiceCollection serviceCollection)
    {
        return serviceCollection
            .AddPacketSerialization()
            .AddSingleton<Contractor>()
            .AddMultiClientHandling()
            .AddMessageResponder<PacketResponder>()
            .AddMessageResponder<RawPacketResponder>()
            .AddSingleton<NosInjector>()
            .AddSingleton<CommsInjector>();
    }
}
Do not follow this link