Skip to content

Commit 1bf5d05

Browse files
Fixed program run
1 parent 7ed1454 commit 1bf5d05

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<ImplicitUsings>enable</ImplicitUsings>
55
<Nullable>enable</Nullable>
66
<IsPackable>true</IsPackable>
7-
<Version>2.1.13</Version>
7+
<Version>2.1.14</Version>
88
<Authors>Andrey Serdyuk</Authors>
99
<Company>TaskHub</Company>
1010
<PackageTags>#TaskHub</PackageTags>

Shared.slnx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Solution>
22
<Folder Name="/.solution_items/">
33
<File Path="Directory.Build.props" />
4-
<File Path="Directory.Packages.props" />
54
</Folder>
65
<Folder Name="/.solution_items/.nuget/">
76
<File Path=".nuget/delist.ps1" />

TaskHub.Shared.Bootstraper/BasicHostBuilder.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class BasicHostBuilder(string[] args)
99
{
1010
private readonly WebApplicationBuilder Builder = WebApplication.CreateBuilder(args);
1111

12-
public BasicHostBuilder Init(Action<WebApplicationBuilder> action)
12+
public void Init(Action<WebApplicationBuilder> action)
1313
{
1414
Builder.Services.AddControllers().AddJsonOptions(o => o.JsonSerializerOptions.PropertyNameCaseInsensitive = true);
1515
Builder.Services.AddEndpointsApiExplorer();
@@ -19,10 +19,9 @@ public BasicHostBuilder Init(Action<WebApplicationBuilder> action)
1919
Builder.Services.AddHttpContextAccessor();
2020
Builder.Services.ConfigureHttpJsonOptions(o => o.SerializerOptions.NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals);
2121
action(Builder);
22-
return this;
2322
}
2423

25-
public async Task<BasicHostBuilder> Run(Action<WebApplication> action)
24+
public async Task Run(Func<WebApplication, Task> action)
2625
{
2726
var app = Builder.Build();
2827

@@ -34,8 +33,7 @@ public async Task<BasicHostBuilder> Run(Action<WebApplication> action)
3433
app.UseHttpsRedirection();
3534
app.UseAuthentication();
3635
app.UseAuthorization();
37-
action(app);
36+
await action(app);
3837
await app.RunAsync();
39-
return this;
4038
}
4139
}

TaskHub.Shared.Bootstraper/FullHostBuilder.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ public FullHostBuilder Use(Action<WebApplication> act)
3333

3434
public async Task StartWith<TContext>(Action<HostOptions> action) where TContext : DbContext
3535
{
36-
var options = new HostOptions();
37-
action(options);
38-
var builder = new BasicHostBuilder(args).Init(builder =>
36+
var host = new BasicHostBuilder(args);
37+
host.Init(builder =>
3938
{
39+
var options = new HostOptions();
40+
action(options);
4041
builder.Services.AddScoped<ICommandsBus, CommandsBus>();
4142
builder.Services.AddAppDbContext<TContext>(builder.Configuration, o => o.ConnectionString = options.ConnectionString);
4243
builder.AddAppAuthentication();
@@ -52,7 +53,7 @@ public async Task StartWith<TContext>(Action<HostOptions> action) where TContext
5253
_initAct(builder);
5354
});
5455

55-
await builder.Run(async app =>
56+
await host.Run(async app =>
5657
{
5758
app.UseOpenTelemetryPrometheusScrapingEndpoint();
5859
await app.Services.MigrateAsync<TContext>();

0 commit comments

Comments
 (0)