Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/AutoMapper/AutoMapper.EF6

Extensions for AutoMapper and EF6
https://github.com/AutoMapper/AutoMapper.EF6

Last synced: about 2 months ago
JSON representation

Extensions for AutoMapper and EF6

Awesome Lists containing this project

README

        

# AutoMapper.EF6
Extensions for AutoMapper and EF6

[![NuGet](http://img.shields.io/nuget/v/AutoMapper.EF6.svg)](https://www.nuget.org/packages/AutoMapper.EF6/)
[![MyGet](https://img.shields.io/badge/MyGet-AutoMapper.EF6-brightgreen)](https://myget.org/feed/automapperdev/package/nuget/AutoMapper.EF6)

This contains some useful extensions I've used with AutoMapper and EF6. Instead of this:

```csharp
Mapper.CreateMap()
.ForMember(d => d.FullName, opt => opt.MapFrom(src => src.FirstName + " " + src.LastName));

var employees = await db.Employees.ProjectTo().ToListAsync();
```

You can do this instead:

```csharp
public class Employee {
[Computed]
public string FullName { get { return FirstName + " " + LastName; } }
}
Mapper.CreateMap();

var employees = await db.Employees.ProjectToListAsync();
```

This package wraps up calling `ProjectTo`, the DelegateDecompiler Decompile/DecompileAsync methods, and then the LINQ methods to execute the queryable (ToList, ToArray, Single, SingleOrDefault etc).