Important
Some information relates to prerelease product that may be substantially modified before itâs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public class DistributedApplication : IAsyncDisposable, IDisposable, Microsoft.Extensions.Hosting.IHost
type DistributedApplication = class
interface IHost
interface IDisposable
interface IAsyncDisposable
Public Class DistributedApplication
Implements IAsyncDisposable, IDisposable, IHost
The following example shows creating a PostgreSQL server resource with a database and referencing that database in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var inventoryDatabase = builder.AddPostgres("mypostgres").AddDatabase("inventory");
builder.AddProject<Projects.InventoryService>()
.WithReference(inventoryDatabase);
builder.Build().Run();
Remarks
The DistributedApplication is an implementation of the IHost interface that orchestrates a .NET Aspire application. To build an instance of the DistributedApplication class, use the CreateBuilder() method to create an instance of the IDistributedApplicationBuilder interface. Using the IDistributedApplicationBuilder interface you can configure the resources that comprise the distributed application and describe the dependencies between them.
Once the distributed application has been defined use the Build() method to create an instance of the DistributedApplication class. The DistributedApplication class exposes a Run() method which then starts the distributed application and its resources.
The CreateBuilder(DistributedApplicationOptions) method provides additional options for constructing the IDistributedApplicationBuilder including disabling the .NET Aspire dashboard (see DisableDashboard) or allowing unsecured communication between the browser and dashboard, and dashboard and app host (see AllowUnsecuredTransport.
The following example shows creating a PostgreSQL server resource with a database and referencing that database in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var inventoryDatabase = builder.AddPostgres("mypostgres").AddDatabase("inventory");
builder.AddProject<Projects.InventoryService>()
.WithReference(inventoryDatabase);
builder.Build().Run();
Constructors Properties Methods Explicit Interface Implementations Extension Methods
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4