IQueryableget distinct results by an objects property

I have this query:

                                                  from snd in _context.SenderPhones
                                                    where snd.ApplicationUserId == applicationUser.Id & !snd.IsDeleted  
                                                    select new
                                                    {
                                                        SenderPhoneId = snd.SenderPhoneId,
                                                        Phone = snd.Phone
                                                    }

I need to find a way not to include duplicate phones. The query has to be IQuerable and not enumerable. Whats the best and most simple way to achieve so.



Read more here: https://stackoverflow.com/questions/66328436/iqueryableget-distinct-results-by-an-objects-property

Content Attribution

This content was originally published by LastGrip at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: