DataService query persons in group?

How can I use the DataService to fetch all persons belonging to a specific group?

Litium version: 7.4

You need to use Dapper instead of DataService because with DataService you will be forced to fetch all customers as a list first and do your selection after and that would be dangerous on large numbers of customers to look up from DB directly.

I had no idea Litium used Dapper. Or do you mean we should implement our own custom orm/data access layer?

Dapper is included in Accelerator.

I suggest to use the DataService directly

using (var q = _dataService.CreateQuery<Person>())
{
    return q.Filter(x => x.ContainsInGroup(GroupSystemId)).ToList();
}
1 Like

Great didn’t find that extension method :slight_smile:

Neither did I… thank’s Patric.
And now that I do know, searching yields this page: https://docs.litium.com/api-reference/api?product=Litium&version=7.4&xref=Litium.Customers.Queryable.PersonFilterDescriptorExtensions
Hopefully you’ll find time to improve the documentation on these things so we get to know about them and can use them.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.