/// <summary>
    /// Adds gRPC JSON transcoding services to the specified <see cref="IGrpcServerBuilder" />.
    /// </summary>
    /// <param name="builder">The <see cref="IGrpcServerBuilder"/>.</param>
    /// <param name="configureOptions">An <see cref="Action{GrpcJsonTranscodingOptions}"/> to configure the provided <see cref="GrpcJsonTranscodingOptions"/>.</param>
    /// <returns>The same instance of the <see cref="IGrpcServerBuilder"/> for chaining.</returns>
    public static IGrpcServerBuilder AddJsonTranscoding(this IGrpcServerBuilder builder, Action <GrpcJsonTranscodingOptions> configureOptions)
    {
        if (builder == null)
        {
            throw new ArgumentNullException(nameof(builder));
        }

        builder.Services.Configure(configureOptions);
        return(builder.AddJsonTranscoding());
    }
Esempio n. 2
0
        /// <summary>
        /// Registers a configuration for the specific ServiceModel.Grpc service in the <see cref="IGrpcServerBuilder"/>.
        /// </summary>
        /// <typeparam name="TService">The implementation type of ServiceModel.Grpc service.</typeparam>
        /// <param name="builder">The <see cref="IGrpcServerBuilder"/>.</param>
        /// <param name="configure">The configuration action to provide a configuration the specific ServiceModel.Grpc service.</param>
        /// <returns><see cref="IGrpcServerBuilder"/>.</returns>
        public static IGrpcServerBuilder AddServiceModelGrpcServiceOptions <TService>(
            this IGrpcServerBuilder builder,
            Action <ServiceModelGrpcServiceOptions <TService> > configure)
            where TService : class
        {
            builder.AssertNotNull(nameof(builder));

            AddServiceModelGrpcServiceOptions(builder.Services, configure);
            return(builder);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds service specific options to an <see cref="IGrpcServerBuilder"/>.
        /// </summary>
        /// <typeparam name="TService">The service type to configure.</typeparam>
        /// <param name="grpcBuilder">The <see cref="IGrpcServerBuilder"/>.</param>
        /// <param name="configure">A callback to configure the service options.</param>
        /// <returns>The same instance of the <see cref="IGrpcServerBuilder"/> for chaining.</returns>
        public static IGrpcServerBuilder AddServiceOptions <TService>(this IGrpcServerBuilder grpcBuilder, Action <GrpcServiceOptions <TService> > configure) where TService : class
        {
            if (grpcBuilder == null)
            {
                throw new ArgumentNullException(nameof(grpcBuilder));
            }

            grpcBuilder.Services.AddSingleton <IConfigureOptions <GrpcServiceOptions <TService> >, GrpcServiceOptionsSetup <TService> >();
            grpcBuilder.Services.Configure(configure);
            return(grpcBuilder);
        }
    /// <summary>
    /// Adds gRPC JSON transcoding services to the specified <see cref="IGrpcServerBuilder" />.
    /// </summary>
    /// <param name="builder">The <see cref="IGrpcServerBuilder"/>.</param>
    /// <returns>The same instance of the <see cref="IGrpcServerBuilder"/> for chaining.</returns>
    public static IGrpcServerBuilder AddJsonTranscoding(this IGrpcServerBuilder builder)
    {
        if (builder == null)
        {
            throw new ArgumentNullException(nameof(builder));
        }

        builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IServiceMethodProvider <>), typeof(JsonTranscodingServiceMethodProvider <>)));

        return(builder);
    }
Esempio n. 5
0
 public Startup(
     IMicroservicesDefinitionsProvider definitionsProvider,
     IGrpcServerBuilder <IAlleyMessageModel, IAlleyMessageModel> serverBuilder,
     IMicroserviceContext microserviceContext,
     IManagementServerRunner managementServerRunner,
     IMonitoringDirector monitoringDirector,
     IConfigurationProvider configurationProvider)
 {
     _definitionProvider     = definitionsProvider;
     _serverBuilder          = serverBuilder;
     _microserviceContext    = microserviceContext;
     _managementServerRunner = managementServerRunner;
     _monitoringDirector     = monitoringDirector;
     _configurationProvider  = configurationProvider;
 }
 public static IGrpcServerBuilder AddFlightServer <T>(this IGrpcServerBuilder grpcServerBuilder)
     where T : FlightServer
 {
     grpcServerBuilder.Services.AddScoped <FlightServer, T>();
     return(grpcServerBuilder);
 }
 public static IGrpcServerBuilder AddKoraliumFlightServer(this IGrpcServerBuilder grpcServerBuilder)
 {
     grpcServerBuilder.AddFlightServer <KoraliumFlightServer>();
     return(grpcServerBuilder);
 }