820808137b
* update DelegateDecompiler.EntityFramework to version 0.34.0 * update EntityFramework to version 6.5.1 ( https://erikej.github.io/ef6/dotnet/2024/05/16/ef6-whatsnew.html ) |
||
---|---|---|
.github/workflows | ||
src/AutoMapper.EF6 | ||
.gitignore | ||
AutoMapper.EF6.sln | ||
Build.ps1 | ||
LICENSE | ||
NuGet.config | ||
Push.ps1 | ||
README.md |
README.md
AutoMapper.EF6
Extensions for AutoMapper and EF6
This contains some useful extensions I've used with AutoMapper and EF6. Instead of this:
Mapper.CreateMap<Employee, EmployeeDto>()
.ForMember(d => d.FullName, opt => opt.MapFrom(src => src.FirstName + " " + src.LastName));
var employees = await db.Employees.ProjectTo<EmployeeDto>().ToListAsync();
You can do this instead:
public class Employee {
[Computed]
public string FullName { get { return FirstName + " " + LastName; } }
}
Mapper.CreateMap<Employee, EmployeeDto>();
var employees = await db.Employees.ProjectToListAsync<EmployeeDto>();
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).