GrumpTech.EntityWebApi.AutoMapper
0.1.3
Prefix Reserved
dotnet add package GrumpTech.EntityWebApi.AutoMapper --version 0.1.3
NuGet\Install-Package GrumpTech.EntityWebApi.AutoMapper -Version 0.1.3
<PackageReference Include="GrumpTech.EntityWebApi.AutoMapper" Version="0.1.3" />
<PackageVersion Include="GrumpTech.EntityWebApi.AutoMapper" Version="0.1.3" />
<PackageReference Include="GrumpTech.EntityWebApi.AutoMapper" />
paket add GrumpTech.EntityWebApi.AutoMapper --version 0.1.3
#r "nuget: GrumpTech.EntityWebApi.AutoMapper, 0.1.3"
#:package GrumpTech.EntityWebApi.AutoMapper@0.1.3
#addin nuget:?package=GrumpTech.EntityWebApi.AutoMapper&version=0.1.3
#tool nuget:?package=GrumpTech.EntityWebApi.AutoMapper&version=0.1.3
EntityWebApi.AutoMapper
Part of EntityWebApi.
This library provides convention-based object mapping, automatically creating mappings between Entity Framework Core entities and DTOs based on their names with minimal configuration.
Getting Started
Register the mapper store
Register the mapper store with the dependency injection container. The mapper store acts as a central registry for named AutoMapper configurations.
services.AddMapperStore();
Configure mappings
Register a named mapper and configure the mappings between your Entity Framework Core entities and DTOs.
app.AddToMapperStore("EntityMapper", config =>
{
config.AddEntityFrameworkCoreCollectionMappers(dataContext);
config.CreateEntityMaps(dataContext, typeStore, "Dto");
config.CreateMapsToEntity(dataContext, typeStore, "PostDto");
config.CreateMapsToEntity(dataContext, typeStore, "PutDto");
config.CreateMapsToEntity(dataContext, typeStore, "PatchDto");
});
This configuration:
- Creates and registers a named mapper called
EntityMapper. - Registers collection mappers that update existing Entity Framework Core navigation collections instead of replacing them, preserving Entity Framework Core change tracking.
- Automatically creates mappings from entities to DTOs whose names end with
Dto. - Automatically creates mappings from DTOs whose names end with
PostDto,PutDto, andPatchDtoback to their corresponding entities.
Retrieve the mapper
Resolve the configured mapper from the mapper store by name.
var mapper = mapperStore.GetMapper("EntityMapper");
The returned IMapper can be used anywhere AutoMapper mappings are required.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AutoMapper (>= 16.2.0)
- AutoMapper.Collection.EntityFrameworkCore (>= 13.0.0)
- GrumpTech.EntityWebApi.Core (>= 0.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.