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).
master | develop | |
---|---|---|
AppVeyor | ||
Travis CI |
master | develop |
---|---|
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();
}
}