AutoMapper.Extensions.Microsoft.DependencyInjection
12.0.1
Prefix Reserved
The functionality of this package is now included directly in AutoMapper.
dotnet add package AutoMapper.Extensions.Microsoft.DependencyInjection --version 12.0.1
NuGet\Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection -Version 12.0.1
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
paket add AutoMapper.Extensions.Microsoft.DependencyInjection --version 12.0.1
#r "nuget: AutoMapper.Extensions.Microsoft.DependencyInjection, 12.0.1"
// Install AutoMapper.Extensions.Microsoft.DependencyInjection as a Cake Addin #addin nuget:?package=AutoMapper.Extensions.Microsoft.DependencyInjection&version=12.0.1 // Install AutoMapper.Extensions.Microsoft.DependencyInjection as a Cake Tool #tool nuget:?package=AutoMapper.Extensions.Microsoft.DependencyInjection&version=12.0.1
AutoMapper extensions for Microsoft.Extensions.DependencyInjection
Scans assemblies and:
- adds profiles to mapping configuration
- adds value resolvers, member value resolvers, type converters to the container.
To use, with an IServiceCollection
instance and one or more assemblies:
services.AddAutoMapper(assembly1, assembly2 /*, ...*/);
or marker types:
services.AddAutoMapper(type1, type2 /*, ...*/);
This registers AutoMapper:
- As a singleton for the
MapperConfiguration
- As a transient instance for
IMapper
ITypeConverter
instances as transientIValueConverter
instances as transientIValueResolver
instances as transientIMemberValueResolver
instances as transientIMappingAction
instances as transient
Mapping configuration is static as it is the root object that can create an IMapper
.
Mapper instances are registered as transient. You can configure this with the serviceLifetime
parameter. Be careful changing this, as Mapper
takes a dependency on a factory method to instantiate the other extensions.
Mapper.Map usage
To map at runtime, add a dependency on IMapper
:
public class EmployeesController {
private readonly IMapper _mapper;
public EmployeesController(IMapper mapper)
=> _mapper = mapper;
// use _mapper.Map to map
}
ProjectTo usage
Starting with 8.0 you can use IMapper.ProjectTo
. The old ProjectTo
is an extension method and does not have dependency injection available. Pass an IConfigurationProvider
instance directly:
var orders = await dbContext.Orders
.ProjectTo<OrderDto>(_configurationProvider)
.ToListAsync();
Or you can use an IMapper
instance:
var orders = await dbContext.Orders
.ProjectTo<OrderDto>(_mapper.ConfigurationProvider)
.ToListAsync();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- AutoMapper (= 12.0.1)
- Microsoft.Extensions.Options (>= 6.0.0)
NuGet packages (952)
Showing the top 5 NuGet packages that depend on AutoMapper.Extensions.Microsoft.DependencyInjection:
Package | Downloads |
---|---|
Omnia.Fx.NetCore
Package Description |
|
NET6CustomLibrary
open source custom dotnet extension library |
|
Elsa.Core
Elsa is a set of workflow libraries and tools that enable lean and mean workflowing capabilities in any .NET Core application. This package contains the core of Elsa. Tip: reference the `Elsa` package instead of this one. |
|
Omnia.Fx.NetCore.Runtime
Package Description |
|
FenixAlliance.ACL.Dependencies
Application Component for the Alliance Business Suite. |
GitHub repositories (194)
Showing the top 5 popular GitHub repositories that depend on AutoMapper.Extensions.Microsoft.DependencyInjection:
Repository | Stars |
---|---|
BeyondDimension/SteamTools
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
|
|
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
|
|
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
|
|
Kareadita/Kavita
Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
|
|
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
|
Version | Downloads | Last updated | |
---|---|---|---|
12.0.1 | 43,625,308 | 4/9/2023 | |
12.0.0 | 34,079,412 | 9/30/2022 | |
11.0.0 | 42,369,473 | 1/5/2022 | |
8.1.1 | 53,025,129 | 2/5/2021 | |
8.1.0 | 13,542,186 | 10/14/2020 | |
8.0.1 | 11,829,797 | 7/16/2020 | |
8.0.0 | 771,940 | 7/9/2020 | |
7.0.0 | 37,399,865 | 8/12/2019 | |
6.1.1 | 4,975,947 | 6/4/2019 | |
6.1.0 | 3,496,201 | 4/29/2019 | |
6.0.0 | 11,252,060 | 11/18/2018 | |
5.0.1 | 6,244,135 | 7/20/2018 | |
4.0.1 | 5,580,086 | 6/18/2018 | |
3.2.0 | 4,187,629 | 11/16/2017 | |
3.1.0 | 261,173 | 10/26/2017 | |
3.0.1 | 539,897 | 8/19/2017 | |
2.0.1 | 981,999 | 3/30/2017 | |
2.0.0 | 38,891 | 3/17/2017 | |
1.2.0 | 203,442 | 12/29/2016 | |
1.1.2 | 93,576 | 9/2/2016 | |
1.1.0 | 172,220 | 8/11/2016 | |
1.0.1-alpha | 12,197 | 7/20/2016 | |
1.0.0-alpha | 3,062 | 7/20/2016 |