自动映射实体和模型

This commit is contained in:
administrator committed 2024-04-04 08:35:01 +08:00
1 parent 5516bb80dd
commit 055cf5997f
5 files changed
+79 -64

No files matched your search

@@ -0,0 +1,16 @@
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
namespace HelloShop.ServiceDefaults.Extensions;
public static class ModelBindingExtensionns
{
public static IServiceCollection AddModelMapper(this IServiceCollection services, Assembly? assembly = null)
{
assembly ??= Assembly.GetCallingAssembly();
services.AddAutoMapper(assembly);
return services;
}
}
@@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0-preview.1.24108.1" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0-preview.1.24113.3" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />