public static IServiceCollection AddSimpleRpcServer(this IServiceCollection services, HttpServerTransportOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var serverTransport = new HttpServerTransport();

            services.AddSingleton <IServerTransport>(serverTransport);
            serverTransport.ConfigureServices(services, options);

            return(services);
        }
예제 #2
0
        public static IServiceCollection AddSimpleRpcServer(this IServiceCollection services, HttpServerTransportOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var serverTransport = new HttpServerTransport();

            services.TryAddSingleton <IServerTransport>(serverTransport);
            services.TryAddSingleton <ISerializationHelper, SerializationHelper>();
            services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IMessageSerializer), typeof(CerasMessageSerializer)));
            serverTransport.ConfigureServices(services, options);

            return(services);
        }