views:

46

answers:

2

Nowadays I see in some developers, use function named GetAll or Getlist in each class. These functions return a list or entity of it's class.

After that, they use these function like this:

dim k = from t in customer.GetAll, p in Product.GetAll where ....

I think there will be a performance problem about this using. Because firstly all of the record for both customer and product table is gotten and then it is eliminated with the where clause.

What do you think about this? Am I right or not?

+1  A: 

They will be lazily evaluated if these methods return IEnumerable<T>.

Darin Dimitrov
Do you mean, only the records that are affected by the where clause will be affected? And won't be there a performance problem?
mavera
+2  A: 

If they are using Linq to SQL, this gets translated to proper SQL and only the records that are affected by the where clause will be returned.

Oded