Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Label="Production">
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.0.0" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="13.0.0" />
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="13.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" />
<PackageReference Include="Aspire.Hosting.RabbitMQ" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Fitnet.Contracts\Src\Fitnet.Contracts\Fitnet.Contracts.csproj" />
<ProjectReference Include="..\Fitnet\Src\Fitnet\Fitnet.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Projects;

var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
.WithImage("postgres", "14.3")
.WithPgAdmin();

var fitnetDatabase = postgres.AddDatabase("fitnetsdb", "fitnet");

var rabbitmq = builder.AddRabbitMQ("rabbitmq")
.WithManagementPlugin();

builder.AddProject<Fitnet>("fitnet-modular-monolith")
.WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development")
.WithReference(fitnetDatabase, "Database__ConnectionString")
.WithReference(rabbitmq, "EventBus__ConnectionString")
.WaitFor(postgres)
.WaitFor(rabbitmq);

builder.AddProject<Fitnet_Contracts>("fitnet-contracts-microservice")
.WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development")
.WithReference(fitnetDatabase, "Database__ConnectionString")
.WithReference(rabbitmq, "EventBus__ConnectionString")
.WaitFor(postgres)
.WaitFor(rabbitmq);

await builder.Build().RunAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.DistributedApplication": "Information"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ internal static IServiceCollection AddEventBus(this IServiceCollection services,
{
return;
}

var uri = options.Value?.Uri;
var username = options.Value?.Username;
var password = options.Value?.Password;
if (!string.IsNullOrEmpty(uri))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3863ac9. Removed extra blank line to comply with IDE0055 formatting rules.

{
factoryConfigurator.Host(uri, h =>
{
if (!string.IsNullOrEmpty(username))
{
h.Username(username);
}
if (!string.IsNullOrEmpty(password))
{
h.Password(password);
}
});
}
factoryConfigurator.ConfigureEndpoints(context);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ internal static IServiceCollection AddEventBus(this IServiceCollection services,
{
return;
}
var uri = options.Value?.Uri;
var username = options.Value?.Username;
var password = options.Value?.Password;
if (!string.IsNullOrEmpty(uri))
{
factoryConfigurator.Host(uri, h =>
{
if (!string.IsNullOrEmpty(username))
{
h.Username(username);
}
if (!string.IsNullOrEmpty(password))
{
h.Password(password);
}
});
}
factoryConfigurator.ConfigureEndpoints(context);
});
configurator.ConfigureOutbox();
Expand Down
20 changes: 20 additions & 0 deletions Chapter-4-applying-tactical-domain-driven-design/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,26 @@ The `Contracts` microservice runs on port `:8081`. Please navigate to http://loc

That's it! You should now be able to run the application using either one of the above. :thumbsup:

=== Run with .NET Aspire

The Fitnet application uses .NET Aspire for local development.

To run the application locally using Aspire, follow these steps:

1. **Ensure Docker is running** on your machine.
2. **Navigate to the AppHost directory:**
[source,shell]
----
cd Fitnet.AppHost
----
3. **Run the AppHost project:**
[source,shell]
----
dotnet run
----

The Aspire Dashboard will open automatically, showing all services, resources, and logs.

=== Building and debugging code in Rider IDE

Before you build or debug code in `Rider` or `Visual Studio` IDE, you first have to provide your username and previously generated PAT for artifactory to download packages for `Common` which is a part of this repository. When you load the solution, your IDE should request the credentials:
Expand Down