blogs

miércoles, 30 de septiembre de 2015

Linq IV: Example of Queries

Prerequisite, you need to see these posts
http://marisolca.blogspot.com/2015/09/linq.html
http://marisolca.blogspot.com/2015/09/linq-iii.html
If you do not know about the Lambda expression , you need to review this post  http://marisolca.blogspot.com/2015/07/lambda-expression.html

These are our two methods that return lists of employees and countries.







  • Groups




We make the previous example of other way




JOIN clause

JOIN with ORDER BY clause




JOIN with GROUP BY clause



Resulting the other way the previous example 






  • INTO clause

It is using for two  different objects in a query expression.

  1. First is that makes possible implement the continuations.
  2. Second ,it allows  expression grouped joins.


1:INTO clause as continuation
It allows perform in cascade two query expressions






2:INTO clause as grouped joins

Produce a sequence in which each element of external sequence is paired  with the group of elements of the internal sequence whose key values comparison matches with the key value comparison of the element the external sequence.


JOIN INTO  clause is translated in a call to GROUPJOIN() standard operator  

We make the previous example of other way


In the next post, I will explain more about queries


No hay comentarios:

Publicar un comentario