Entity Framework extensions for AutoMapper


I pushed out a little library I’ve been using for the last couple years for helping to use AutoMapper and Entity Framework together. It’s a series of extension methods that cuts down the number of calls going from a DbSet to DTOs. Instead of this:

You do this:

The extension methods themselves are not that exciting, it’s just code I’ve been copying from project to project:

I have helper methods for:

  • ToList
  • ToArray
  • ToSingle
  • ToSingleOrDefault
  • ToFirst
  • ToFirstOrDefault

As well as all their async versions. You can find it on GitHub:

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

And on NuGet:

https://www.nuget.org/packages/automapper.ef6

Enjoy!

AutoMapper dev builds moved to MyGet