Comments (8)
Hi,
map config:
CreateMap<Model, ViewModel>()
.ForMember(dest => dest.property, opt => opt.MapFrom(src => src.property));
CreateMap<IPagedList<Model>, IPagedList<ViewModel>>()
.ConvertUsing<PagedListToPagedListConverter<Model, ViewModel>>();
converter class:
public class PagedListToPagedListConverter<T1, T2> : ITypeConverter<IPagedList<T1>, IPagedList<T2>>
{
public IPagedList<T2> Convert(
IPagedList<T1> source,
IPagedList<T2> destination,
ResolutionContext context)
{
var models = source as PagedList<T1>;
return PagedList.From(models, c => new List<T2>(Mapper.Map<IEnumerable<T2>>(c)));
}
}
from unitofwork.
Maybe, let me try later
from unitofwork.
Helped You?
from unitofwork.
Good start, thanks
from unitofwork.
Sorry for late reply, I went with GetAll method to get IQueryable and projected it with automapper.
-A
from unitofwork.
Thank you @Wielebny666 !!!
from unitofwork.
Hello @Wielebny666
I am using this framework
And i dont know how to use the PagedListToPagedListConverter in GetPagedListAsync
Can you open this topic a little more?
Its important subject.
Please help me
from unitofwork.
@akinihsan
do you have comments pls?
from unitofwork.
Related Issues (20)
- Add IgnoreQueryFilters HOT 1
- GetPagedListAsync with mapping in selector and includes don't work HOT 1
- SaveChangesAsync(bool ensureAutoHistory = false, params IUnitOfWork[] unitOfWorks)这个怎么使用 HOT 13
- EfCore .30 HOT 3
- EF 3.1 - InsertAsync - Method not found HOT 4
- Update Nuget Please HOT 5
- add in GroupBy HOT 2
- 第一次修改表名会报NullException HOT 1
- 张帅,把范型仓储直接注入到容器吧
- UnitOfWork中SaveChangesAsync两个重载很歧义啊 HOT 1
- Add custom method to a custom repository HOT 2
- 分表操作:第一次调用仓储对象的ChangeTable指定新表时就报这样的错,但是第二次就不会报错,每次都是在运行项目后第一次调用时报错 System.NullReferenceException:“Object reference not set to an instance of an object HOT 5
- GetPagedList orderBy parameter HOT 2
- hi, do you have any plan for EF .NET 5.0? HOT 6
- Is it worth to add plain List() methods other than Page? HOT 2
- 当我们用unitOfwork时, 怎么避免不同的线程操作?
- Microsoft.Extensions.Logging.ILoggingBuilder HOT 6
- did you stopped updating this repo? HOT 7
- how to use Auto Include HOT 1
- NuGet package 3.1.0 does not support .NET 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unitofwork.