Format:
Recent snippets matching tags of AutoMapper
void Main() { AutoMapper.Mapper.CreateMap<Contact, KeyValuePair<Guid, string>>() .ConstructUsing(x => new KeyValuePair<Guid, string>(x.Id, x.FullName)); //var contacts = ContactRepository.GetAll(); // Returns IList<Contact> var contacts = new List<Contact> { new Contact { Id = Guid.NewGuid(), FullName = "Joe Bob" }, new Contact { Id = Guid.NewGuid(), FullName = "Sally Jones" }, };
301 Views
no comments
public static class MapExtensions { public static IMappingExpression<IPagination<TSource>, IPagination<TDestination>> ConstructPagination<TSource, TDestination>(this IMappingExpression<IPagination<TSource>, IPagination<TDestination>> map) where TSource : class where TDestination : class { return map.ConstructUsing(src => new CustomPagination<TDestination>(src.ToList().Select(p => AutoMapper.Mapper.Map<TSource, TDestination>(p)), src.PageNumber, src.PageSize,
582 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
