Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Some extensions to ease development of gRPC services in .NET

License

Notifications You must be signed in to change notification settings

CodingMilitia/GrpcExtensions

Repository files navigation

GrpcExtensions

Some extensions to ease development of gRPC services in .NET

Trying to simplify dependency injection configuration and stuff like that, without going as crazy as in the other project (this one here).

Build status

master develop
AppVeyor Build status Build status
Travis CI Build Status Build Status

Coverage status

master develop
Coverage Status Coverage Status

Sample

Just a quick sample, for a bit more detail check the samples folder.

class Program
{
    static async Task Main(string[] args)
    {
        var serverHostBuilder = new HostBuilder()
        .ConfigureAppConfiguration((hostingContext, config) =>
        {
            //...
        })
        .ConfigureLogging((context, logging) =>
        {
            //...
        })
        .ConfigureServices((hostContext, services) =>
        {
            services
            .AddScoped<ISampleServiceLogic, RandomSampleServiceLogic>()
            .AddGrpcServer<SampleServiceImplementation>(
                new[] { 
                    new ServerPort("127.0.0.1", 5050, ServerCredentials.Insecure) 
                }
            );
        });

        await serverHostBuilder.RunConsoleAsync();
    }
}