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

Explain more #134

Open
msh13792 opened this issue Mar 12, 2017 · 1 comment
Open

Explain more #134

msh13792 opened this issue Mar 12, 2017 · 1 comment

Comments

@msh13792
Copy link

Hi
Please explain how i can use express mapper for this :
this function response me a list of data with hierarchical form

var data = GetTree(repository, null);

List<DTO.Comments.Read> GetTree(List<Results.Comment_Result> list, int? parent)
{
return list.Where(x => x.ParentId == parent).Select(x => new DTO.Comments.Read
{
Id = x.Id,
Author = x.Author,
CommentType = x.CommentType,
Content = x.Content,
DislikeCount = x.DislikeCount,
Email = x.Email,
IPAddress = x.IPAddress,
ParentId = x.ParentId,
LikeCount = x.LikeCount,
ProviderId = x.ProviderId,
ProviderType = x.ProviderType,
CreateDatetime = x.CreateDatetime,
Items = GetTree(list, x.Id)
}).ToList();
}

@JonPSmith
Copy link
Contributor

Hi @msh13792,

You might find an article I wrote called Flattening Entity Framework relationships with ExpressMapper useful. Go to the section called Introducing ExpressMapper and I describe how you can handle hierarchical data using ExpressMapper.

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

No branches or pull requests

2 participants