TaskHub.Shared

Using Host Builders

TaskHub.Shared provides two Host Builder templates to drastically reduce the time needed to set up a new microservice.

1. BasicHostBuilder

Use this for simple services that don’t need the full TaskHub infrastructure (e.g., a simple health-check service or a minimal proxy).

Features

Example

var builder = new BasicHostBuilder(args);
builder.Start();
await builder.Run();

2. FullHostBuilder

This is the standard builder for most TaskHub microservices. It “batteries-included” and wires up almost every module in the solution.

Features

Example

var builder = new FullHostBuilder(args);

// Starts the service and performs DB migrations for MyDbContext
await builder.Run<MyDbContext>(); 

Customizing the Builder

You can still access the underlying WebApplicationBuilder to add service-specific dependencies.

var builder = new FullHostBuilder(args);
builder.Start<MyDbContext>(b => {
    b.Services.AddScoped<IMySpecialService, MySpecialService>();
});
await builder.Run<MyDbContext>();

Why use Host Builders?

They enforce the TaskHub Standard Architecture. By using these builders, you ensure that every microservice in your ecosystem has the same logging, the same tracing, the same security patterns, and the same error handling, making the entire system much easier to maintain.