NeatMapper.EntityFrameworkCore 5.0.0

dotnet add package NeatMapper.EntityFrameworkCore --version 5.0.0                
NuGet\Install-Package NeatMapper.EntityFrameworkCore -Version 5.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NeatMapper.EntityFrameworkCore" Version="5.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NeatMapper.EntityFrameworkCore --version 5.0.0                
#r "nuget: NeatMapper.EntityFrameworkCore, 5.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NeatMapper.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=NeatMapper.EntityFrameworkCore&version=5.0.0

// Install NeatMapper.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=NeatMapper.EntityFrameworkCore&version=5.0.0                

.NEaT Mapper - Entity Framework Core

NuGet

What is this package

Entity Framework Core maps for NeatMapper.

Creates automatic maps and projections between entities and their keys (even composite and shadow keys), supports normal maps and asynchronous ones, also supports collections (not nested).

How to install

You can find all the other packages on Nuget https://www.nuget.org/profiles/xriuk

You can install this package directly from Nuget https://www.nuget.org/packages/NeatMapper.EntityFrameworkCore

How to use

While configuring your services simply add

services.AddDbContext<TestContext>();
services.AddNeatMapper();

services.AddNeatMapperEntityFrameworkCore<TestContext>();

And you are ready to map your entities

var mapper = serviceProvider.GetRequiredService<IMapper>();
var asyncMapper = serviceProvider.GetRequiredService<IMapper>();
var projector = serviceProvider.GetRequiredService<IProjector>();


// Map a key to its entity
var entity = mapper.Map<MyEntity>(2);
var entity = await asyncMapper.MapAsync<MyEntity>(2);

// Map a composite key to an entity with tuples (System.Tuple or System.ValueTuple),
// notice the double parentheses
var entity = await asyncMapper.MapAsync<MyEntityWithCompositeKey>((2, "StringKey"));

// Map multiple keys to their respective entities
var entities = await asyncMapper.MapAsync<MyEntity[]>(new int[]{ 2, 3, ... });


// Map an entity to its key(s)
(int MyIntKey, string MyStringKey) = mapper.Map<(int, string)>(myEntity);


// Project an entity into its key
var myEntitiesKeys = db.Set<MyEntity>()
    .Project<int>(projector)
    .ToArray();

Advanced options

Find more advanced use cases in the website or in the extended tests project.

License

Read the license here

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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 is compatible. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0 70 11/3/2024
4.0.0 98 7/16/2024
3.1.0 115 4/26/2024
2.2.0 157 2/3/2024
2.1.0 227 12/5/2023
2.0.0 166 11/12/2023