Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Program.cs file to each module was the issue. #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
87 changes: 59 additions & 28 deletions booking-modular-monolith-sample.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Api", "Api", "{F7A6067F-42D3-4F59-BC88-0A57A4B903F1}"
EndProject
Expand All @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{34A7
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA40C0D9-091C-4098-8F0E-FEA1C777303E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildingBlocks", "src\BuildingBlocks\BuildingBlocks.csproj", "{285E55A8-0C26-41DB-AD72-0D0557BDAE76}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildingBlocks", "src\BuildingBlocks\BuildingBlocks.csproj", "{285E55A8-0C26-41DB-AD72-0D0557BDAE76}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Booking", "Booking", "{F8725F12-8D95-4A62-9D27-84909E215D36}"
EndProject
Expand All @@ -29,41 +29,29 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{70395541-D3C
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0468D5FF-FA73-422F-AB68-A3900B0DB937}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flight", "src\Modules\Flight\src\Flight\Flight.csproj", "{56CE1785-AA9B-427E-AE29-492A637DDD1A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flight", "src\Modules\Flight\src\Flight\Flight.csproj", "{56CE1785-AA9B-427E-AE29-492A637DDD1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Identity", "src\Modules\Identity\src\Identity\Identity.csproj", "{7A590034-D985-4BC6-82ED-83839AAB052D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Identity", "src\Modules\Identity\src\Identity\Identity.csproj", "{7A590034-D985-4BC6-82ED-83839AAB052D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Passenger", "src\Modules\Passenger\src\Passenger\Passenger.csproj", "{747845A0-25C5-4E01-A735-1B1E2ADA9554}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Passenger", "src\Modules\Passenger\src\Passenger\Passenger.csproj", "{747845A0-25C5-4E01-A735-1B1E2ADA9554}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Booking", "src\Modules\Booking\src\Booking\Booking.csproj", "{E534AFC5-DC20-479F-8AC1-86CD28ABA682}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking", "src\Modules\Booking\src\Booking\Booking.csproj", "{E534AFC5-DC20-479F-8AC1-86CD28ABA682}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "src\Api\src\Api.csproj", "{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "src\Api\src\Api.csproj", "{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Booking.Api", "src\Modules\Booking\src\Booking.Api\Booking.Api.csproj", "{BB3B9761-FA12-47A0-B630-35F5FCAF5A93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Identity.Api", "src\Modules\Identity\src\Identity.Api\Identity.Api.csproj", "{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flight.Api", "src\Modules\Flight\src\Flight.Api\Flight.Api.csproj", "{3AE5F6C4-D2D3-4564-84AF-DC773A85083E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Passenger.Api", "src\Modules\Passenger\src\Passenger.Api\Passenger.Api.csproj", "{13A85C52-7AC7-4AE9-BDF6-96611B269EC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CA40C0D9-091C-4098-8F0E-FEA1C777303E} = {F7A6067F-42D3-4F59-BC88-0A57A4B903F1}
{285E55A8-0C26-41DB-AD72-0D0557BDAE76} = {BD4BC863-4353-4CDF-8085-F0212A2EEA11}
{F8725F12-8D95-4A62-9D27-84909E215D36} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{4A86BE62-83F4-4CB6-94F8-A5F00304A44E} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{CB89FC18-7C55-4671-A4D6-025FF54C2741} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{E5653FEF-8BC9-4B78-AF78-10BA09A06462} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{BAB888BA-2703-4114-93C2-501EA48454E4} = {F8725F12-8D95-4A62-9D27-84909E215D36}
{2BF6ABC1-6F8C-4FE2-97DB-862669F3913F} = {4A86BE62-83F4-4CB6-94F8-A5F00304A44E}
{70395541-D3C0-4E8B-830F-E1C93926F9C8} = {CB89FC18-7C55-4671-A4D6-025FF54C2741}
{0468D5FF-FA73-422F-AB68-A3900B0DB937} = {E5653FEF-8BC9-4B78-AF78-10BA09A06462}
{56CE1785-AA9B-427E-AE29-492A637DDD1A} = {2BF6ABC1-6F8C-4FE2-97DB-862669F3913F}
{7A590034-D985-4BC6-82ED-83839AAB052D} = {70395541-D3C0-4E8B-830F-E1C93926F9C8}
{747845A0-25C5-4E01-A735-1B1E2ADA9554} = {0468D5FF-FA73-422F-AB68-A3900B0DB937}
{E534AFC5-DC20-479F-8AC1-86CD28ABA682} = {BAB888BA-2703-4114-93C2-501EA48454E4}
{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4} = {CA40C0D9-091C-4098-8F0E-FEA1C777303E}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{285E55A8-0C26-41DB-AD72-0D0557BDAE76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{285E55A8-0C26-41DB-AD72-0D0557BDAE76}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand All @@ -89,5 +77,48 @@ Global
{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4}.Release|Any CPU.Build.0 = Release|Any CPU
{BB3B9761-FA12-47A0-B630-35F5FCAF5A93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB3B9761-FA12-47A0-B630-35F5FCAF5A93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB3B9761-FA12-47A0-B630-35F5FCAF5A93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB3B9761-FA12-47A0-B630-35F5FCAF5A93}.Release|Any CPU.Build.0 = Release|Any CPU
{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656}.Release|Any CPU.Build.0 = Release|Any CPU
{3AE5F6C4-D2D3-4564-84AF-DC773A85083E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3AE5F6C4-D2D3-4564-84AF-DC773A85083E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3AE5F6C4-D2D3-4564-84AF-DC773A85083E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3AE5F6C4-D2D3-4564-84AF-DC773A85083E}.Release|Any CPU.Build.0 = Release|Any CPU
{13A85C52-7AC7-4AE9-BDF6-96611B269EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13A85C52-7AC7-4AE9-BDF6-96611B269EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13A85C52-7AC7-4AE9-BDF6-96611B269EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13A85C52-7AC7-4AE9-BDF6-96611B269EC6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CA40C0D9-091C-4098-8F0E-FEA1C777303E} = {F7A6067F-42D3-4F59-BC88-0A57A4B903F1}
{285E55A8-0C26-41DB-AD72-0D0557BDAE76} = {BD4BC863-4353-4CDF-8085-F0212A2EEA11}
{F8725F12-8D95-4A62-9D27-84909E215D36} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{4A86BE62-83F4-4CB6-94F8-A5F00304A44E} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{CB89FC18-7C55-4671-A4D6-025FF54C2741} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{E5653FEF-8BC9-4B78-AF78-10BA09A06462} = {34A73111-C432-4051-ACE5-968F7ED3F634}
{BAB888BA-2703-4114-93C2-501EA48454E4} = {F8725F12-8D95-4A62-9D27-84909E215D36}
{2BF6ABC1-6F8C-4FE2-97DB-862669F3913F} = {4A86BE62-83F4-4CB6-94F8-A5F00304A44E}
{70395541-D3C0-4E8B-830F-E1C93926F9C8} = {CB89FC18-7C55-4671-A4D6-025FF54C2741}
{0468D5FF-FA73-422F-AB68-A3900B0DB937} = {E5653FEF-8BC9-4B78-AF78-10BA09A06462}
{56CE1785-AA9B-427E-AE29-492A637DDD1A} = {2BF6ABC1-6F8C-4FE2-97DB-862669F3913F}
{7A590034-D985-4BC6-82ED-83839AAB052D} = {70395541-D3C0-4E8B-830F-E1C93926F9C8}
{747845A0-25C5-4E01-A735-1B1E2ADA9554} = {0468D5FF-FA73-422F-AB68-A3900B0DB937}
{E534AFC5-DC20-479F-8AC1-86CD28ABA682} = {BAB888BA-2703-4114-93C2-501EA48454E4}
{3B2CDE51-E7F9-418E-AA28-4BFD86C728F4} = {CA40C0D9-091C-4098-8F0E-FEA1C777303E}
{BB3B9761-FA12-47A0-B630-35F5FCAF5A93} = {BAB888BA-2703-4114-93C2-501EA48454E4}
{55E5C66B-FC0C-4B5B-A0F3-A4DF13172656} = {70395541-D3C0-4E8B-830F-E1C93926F9C8}
{3AE5F6C4-D2D3-4564-84AF-DC773A85083E} = {2BF6ABC1-6F8C-4FE2-97DB-862669F3913F}
{13A85C52-7AC7-4AE9-BDF6-96611B269EC6} = {0468D5FF-FA73-422F-AB68-A3900B0DB937}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A809DAA3-8F41-4B78-8F09-F03B2FB31AB5}
EndGlobalSection
EndGlobal
17 changes: 17 additions & 0 deletions src/Modules/Booking/src/Booking.Api/Booking.Api.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Booking\Booking.csproj" />
</ItemGroup>

</Project>
67 changes: 67 additions & 0 deletions src/Modules/Booking/src/Booking.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Booking;
using BuildingBlocks.CAP;
using BuildingBlocks.Domain;
using BuildingBlocks.Exception;
using BuildingBlocks.Jwt;
using BuildingBlocks.Logging;
using BuildingBlocks.MediatR;
using BuildingBlocks.Swagger;
using BuildingBlocks.Web;
using Figgle;
using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Serilog;

var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration;
var env = builder.Environment;

var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));

builder.AddCustomSerilog(env);
builder.Services.AddJwt();
builder.Services.AddControllers();
builder.Services.AddHttpContextAccessor();

builder.Services.AddCustomCap();
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
builder.Services.AddCustomVersioning();

builder.Services.AddCustomSwagger(configuration,
typeof(BookingRoot).Assembly);

builder.Services.AddCustomProblemDetails();

builder.Services.AddBookingModules(configuration);

builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });

builder.Services.AddCustomMediatR(
typeof(BookingRoot).Assembly
);

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
var provider = app.Services.GetService<IApiVersionDescriptionProvider>();
app.UseCustomSwagger(provider);
}

app.UseSerilogRequestLogging();
app.UseCorrelationId();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseHttpsRedirection();

app.UseBookingModules();

app.UseProblemDetails();

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });

app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));

app.Run();
41 changes: 41 additions & 0 deletions src/Modules/Booking/src/Booking.Api/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:62393",
"sslPort": 44326
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5156",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7195;http://localhost:5156",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
43 changes: 43 additions & 0 deletions src/Modules/Booking/src/Booking.Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"AppOptions": {
"Name": "Booking-Modular-Monolith"
},
"LogOptions": {
"Level": "information",
"LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}",
"Elastic": {
"Enabled": true,
"ElasticServiceUrl": "http://localhost:9200"
},
"File": {
"Enabled": false,
"Path": "logs/logs.txt",
"Interval": "day"
},
"Sentry": {
"Enabled": false,
"Dsn": "",
"MinimumBreadcrumbLevel": "information",
"MinimumEventLevel": "error"
}
},
"ConnectionStrings": {
"Booking": "Server=.\\sqlexpress;Database=BookingDB-Monolith;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Jwt": {
"Authority": "https://localhost:5000",
"Audience": "booking"
},
"Grpc": {
"FlightAddress": "https://localhost:5000",
"PassengerAddress": "https://localhost:5000"
},
"EventStore": {
"ConnectionString": "esdb://localhost:2113?tls=false"
},
"PersistMessageOptions": {
"Interval": 30,
"Enabled": true
},
"AllowedHosts": "*"
}
17 changes: 17 additions & 0 deletions src/Modules/Flight/src/Flight.Api/Flight.Api.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Flight\Flight.csproj" />
</ItemGroup>

</Project>
67 changes: 67 additions & 0 deletions src/Modules/Flight/src/Flight.Api/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using BuildingBlocks.CAP;
using BuildingBlocks.Domain;
using BuildingBlocks.Exception;
using BuildingBlocks.Jwt;
using BuildingBlocks.Logging;
using BuildingBlocks.MediatR;
using BuildingBlocks.Swagger;
using BuildingBlocks.Web;
using Figgle;
using Flight;
using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Serilog;

var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration;
var env = builder.Environment;

var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions");
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name));

builder.AddCustomSerilog(env);
builder.Services.AddJwt();
builder.Services.AddControllers();
builder.Services.AddHttpContextAccessor();

builder.Services.AddCustomCap();
builder.Services.AddTransient<IBusPublisher, BusPublisher>();
builder.Services.AddCustomVersioning();

builder.Services.AddCustomSwagger(configuration,
typeof(FlightRoot).Assembly);

builder.Services.AddCustomProblemDetails();

builder.Services.AddFlightModules(configuration);

builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); });

builder.Services.AddCustomMediatR(
typeof(FlightRoot).Assembly
);

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
var provider = app.Services.GetService<IApiVersionDescriptionProvider>();
app.UseCustomSwagger(provider);
}

app.UseSerilogRequestLogging();
app.UseCorrelationId();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseHttpsRedirection();

app.UseFlightModules();

app.UseProblemDetails();

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });

app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));

app.Run();
Loading