Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AutoMapper/AutoMapper.EF6
Extensions for AutoMapper and EF6
https://github.com/AutoMapper/AutoMapper.EF6
Last synced: 8 days ago
JSON representation
Extensions for AutoMapper and EF6
- Host: GitHub
- URL: https://github.com/AutoMapper/AutoMapper.EF6
- Owner: AutoMapper
- License: mit
- Created: 2015-07-06T20:58:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T06:41:33.000Z (3 months ago)
- Last Synced: 2024-10-28T23:25:57.535Z (16 days ago)
- Language: C#
- Size: 40 KB
- Stars: 223
- Watchers: 27
- Forks: 45
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).