Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use AutoMapper for LoadResult #335

Closed
itprodavets opened this issue Feb 20, 2019 · 1 comment
Closed

How to use AutoMapper for LoadResult #335

itprodavets opened this issue Feb 20, 2019 · 1 comment
Assignees

Comments

@itprodavets
Copy link

itprodavets commented Feb 20, 2019

I have code:

            var list = _unitOfWork.DbContext.Models
                .FromSql(Resource.Models)
                .AsNoTracking();

            var result = DataSourceLoader.Load(list, request);

How I can change model after getting result?

@AlekseyMartynov
Copy link
Contributor

Typically, model transformations are done prior to Load, because you want load options (sort, filter, etc) to match the model properties:

var projection = list.Select(i => ...);
var result = DataSourceLoader.Load(projection, request);

However, if you have a specific need to transform data after DataSourceLoader.Load then you can manipulate the result.data property.

It's an opaque non-generic IEnumerable the exact item type of which depends on load options. It can be a collection of groups, expando objects, or original data items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants