Using distinct with Entity Framework

Asked

Viewed 1,154 times

2

I have an object with a structure something like this:

  • Date
  • Description

I’m thinking a distinct() in the description field because the records are ridiculously repeated.

The question is, the distinct() considers only the first or last record?

  • Could exemplify what you have and show what you would like to get?

2 answers

2


It considers all columns that are in select.

Select Data, Descricao from ....

data1 teste
data2 teste
data3 teste
data4 teste

In that case the distinct would change nothing in the result.

  • Can you please update your response by placing it within an Entity Framework scope? I drew attention to the author of the question, who did not say what he wanted.

0

My question was not so clear, in any way Ricardo’s answer helped me in a general concept.

My resolution was quite alternative, follows:

inserir a descrição da imagem aqui

  • 1

    It would be interesting, instead of you taking a picture with the code, putting the code as text so that other people can copy and paste the text. It would be more helpful this way. Anyway, I’m going to make some adjustments to your question so that it has a greater reach for the community.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.