This PR re-implements internal gRPC method binding logics.
Before this PR, The service registration logic for Unary/StreamingHub was independent from Grpc.AspNetCore.Server framework. Now, the registration logic of MagicOnion is being re-implemented more tightly based on Grpc.AspNetCore.Server.
This allows more flexible configuration of the MagicOnion gRPC service endpoint. MagicOnion endpoints can be registered in multiple calls.
var builder = WebApplicationBuilder.CreateBuilder(args);
builder.Services.AddMagicOnion();
var app = builder.Build();
// Register all Unary/StreamingHub services from loaded assemblies.
// app.MapMagicOnionService();
// Consumers endpoints
app.MapMagicOnionService([typeof(GreeterService), typeof(ChatHub)]);
// Administration endpoints
app.MapMagicOnionService([typeof(AdministrationService)])
.RequireHost("*:6000")
.RequireAuthorization();
app.Run();
Breaking changes
Obsolete AddMagicOnion(Assembly[] searchAssemblies) and AddMagicOnion(IEnumerable<Type> searchTypes)
services.AddMagicOnion(Assembly[] searchAssemblies) and services.AddMagicOnion(IEnumerable<Type> searchTypes) no longer work. Use app.MapMagicOnionService instead.
// Before
var builder = WebApplicationBuilder.CreateBuilder(args);
builder.Services.AddMagicOnion([typeof(MyService), typeof(MyHub)]);
var app = builder.Build();
app.MapMagicOnionService();
app.Run();
// After
var builder = WebApplicationBuilder.CreateBuilder(args);
builder.Services.AddMagicOnion();
var app = builder.Build();
app.MapMagicOnionService([typeof(MyService), typeof(MyHub)]);
app.Run();
This PR re-implements internal gRPC method binding logics.
Before this PR, The service registration logic for Unary/StreamingHub was independent from Grpc.AspNetCore.Server framework. Now, the registration logic of MagicOnion is being re-implemented more tightly based on Grpc.AspNetCore.Server.
This allows more flexible configuration of the MagicOnion gRPC service endpoint. MagicOnion endpoints can be registered in multiple calls.
Breaking changes
Obsolete
AddMagicOnion(Assembly[] searchAssemblies)
andAddMagicOnion(IEnumerable<Type> searchTypes)
services.AddMagicOnion(Assembly[] searchAssemblies)
andservices.AddMagicOnion(IEnumerable<Type> searchTypes)
no longer work. Useapp.MapMagicOnionService
instead.