diff --git a/README.md b/README.md index b0fcc22..a1b0214 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ # AutoMapper.EF6 Extensions for AutoMapper and EF6 + +This contains some useful extensions I've used with AutoMapper and EF6. Instead of this: + +``` +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: + +``` +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).