https://github.com/AutoMapper/AutoMapper.EF6
Extensions for AutoMapper and EF6
https://github.com/AutoMapper/AutoMapper.EF6
Last synced: 3 months 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 (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T06:41:33.000Z (11 months ago)
- Last Synced: 2025-04-01T11:03:35.854Z (3 months ago)
- Language: C#
- Size: 40 KB
- Stars: 224
- Watchers: 26
- Forks: 46
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AutoMapper.EF6
Extensions for AutoMapper and EF6[](https://www.nuget.org/packages/AutoMapper.EF6/)
[](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).