Skip to content

Demos of the talk I did in the Virtual NetCoreConf 2021 in Spain

Notifications You must be signed in to change notification settings

J0rgeSerran0/NetCoreConf_2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Demos of the talk I did in the Virtual NetCoreConf 2021 in Spain (26th - 27th of February)

gRPC - Introducción a desarrolladores ASP.NET Core

Presentation (pdf in Spanish)

NetCoreConf 2021 - Presentation

Samples

Typical gRPC Hello World sample that is shown in the talk (using Unary)

Client => .NET Core 3.1
Server => .NET 5

protobuf file

Startup.cs

Important parts in the sample:

public void ConfigureServices(IServiceCollection services)
{
    services.AddGrpc();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    // MORE CODE HERE

    app.UseStaticFiles();
    app.UseRouting();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapGrpcService<GreeterService>();

        // MORE CODE HERE
    });
}

gRPC sample that is shown in the talk (using Unary, Server Streaming, Client Streaming, Bidirectional Streaming)

Client => .NET 5
Server => .NET 5

protobuf file

Startup.cs

Important parts in the sample:

public void ConfigureServices(IServiceCollection services)
{
    services.AddGrpc();
    services.AddSingleton<StoreRepository>();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    // MORE CODE HERE

    app.UseRouting();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapGrpcService<StoreService>();

        // MORE CODE HERE
    });
}