Skip to content

Commit

Permalink
use netcorepal v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
witskeeper committed Jan 15, 2025
1 parent 45a7f7c commit 33ce59a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion template/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<NetCorePalVersion>2.1.0</NetCorePalVersion>
<NetCorePalVersion>2.2.0</NetCorePalVersion>
<FrameworkVersion>9.0.0</FrameworkVersion>
<ExtensionsVersion>9.0.0</ExtensionsVersion>
<EntityFrameworkVersion>9.0.0</EntityFrameworkVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public partial class Order : Entity<OrderId>, IAggregateRoot
/// <summary>
/// 受保护的默认构造函数,用以作为EF Core的反射入口
/// </summary>
protected Order() { }
protected Order()
{
}

public Order(string name, int count)
{
Expand All @@ -31,6 +33,10 @@ public Order(string name, int count)

public int Count { get; private set; }

public RowVersion RowVersion { get; private set; } = new RowVersion();

public UpdateTime UpdateTime { get; private set; } = new UpdateTime(DateTimeOffset.UtcNow);

public void OrderPaid()
{
if (Paid)
Expand All @@ -44,4 +50,4 @@ public void OrderPaid()
}
}
}
}
}
5 changes: 1 addition & 4 deletions template/src/ABC.Template.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@

#region Controller

builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new EntityIdJsonConverterFactory());
});
builder.Services.AddControllers().AddNetCorePalSystemTextJson();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c => c.AddEntityIdSchemaMap()); //强类型id swagger schema 映射
Expand Down
4 changes: 2 additions & 2 deletions template/test/ABC.Template.Web.Tests/DemoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public DemoTests(MyWebApplicationFactory factory)


[Fact]
public void HealthCheckTest()
public async Task HealthCheckTest()
{
var response = _client.GetAsync("/health").Result;
var response = await _client.GetAsync("/health");
Assert.True(response.IsSuccessStatusCode);
}

Expand Down

0 comments on commit 33ce59a

Please sign in to comment.