linq query nested subqueries

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44540236/article/details/97482096
开发工具与关键技术:VS    NVC
作者:听民谣的老猫
撰写时间:2019/7/22   18:15

Tell a more practical function ____linq query nested subqueries.

 

Usually we encounter such a situation above, we definitely think about it more than one field behind the schedule of a synthetic field, this data is a synthesis of four data.

The reason for this situation:

 

First of all you should be even with the table query, the data in this table even when you do not always single. Why even this table will become a plurality of data it?

 

Because the design of the database this table is one to many ( that is, a FlightID corresponds to a number of CycleID ), so you can check out the corresponding data is four.

This situation corresponds to what I suggest you use it (nested subqueries linq query).

 

As results, the four original data is the same data a synthesized one, this field will be synthesized by a schedule, relative to the beginning of the data is much less.

Code section

This custom class field not do too much explanation. We have talked about.

 

This is the self-definition of the original string on the basis of class, int type to a custom class with another type of list, because the schedule is definitely more than the data, if the data type is certainly no list will complain.

 

This custom class List and also with the previous speak no difference.

 

With the need linq query after our original nested subqueries even goes into a data table, in the original linq linq query and then a nested query, in line with this schedule corresponds flights can also be queried correctly come out.

 

There is also a need for a data table row corresponding to custom, the data registration function to reach.

 

 

Guess you like

Origin blog.csdn.net/weixin_44540236/article/details/97482096