Linq nested subqueries

Linq nested subqueries

文献种类:专题技术文献;
开发工具与关键技术:VS
作者:蛋蛋;
撰写时间:2019/04/20

One. What is Linq statement? C # and VB.NET is the unified query syntax for storing and retrieving data from different sources. It incorporates in C # or VB, thereby eliminating the mismatch between the programming language and the database, and provide a single query interface for different types of data sources.
For example, SQL is a structured query language for data storage and retrieval in the database. Query multiple data sources in a standardized way: You can use the same LINQ syntax to query multiple data sources. Make the code more readable, it reduces the amount of code to be written.

two. Linq and Linq nested sub-query What is the difference? Linq nested subquery is performed on a basis Linq or more nested, nested generally sufficient twice, one to two to reduce the burden on the server thinking logic conversion
III. Next we look at case diagram:
Here Insert Picture Description
As shown, the authority I need to make a query from the module to the operating table type table but two tables unrelated, can not be directly connected, this time you need an intermediary table ( module list) were set up so that you can get to the operating table module type field in the table, in order to achieve all of the conditions I want to check out.

  1. Need to think of contingency tables established entity class
    needs to establish when it comes to multi-table entity class, inherit the main table and then add the missing field to which an entity class; named ... VoVo: is the abbreviation for the value object; role: to take it value convenience, the data is encapsulated into an object, which is what we call VoVo is mainly used for data processing between the logical encapsulation layer (the Controllers) and the presentation layer (the Views)
  2. ModularAndDetailVo word from the surface is understood to mean the combination of two words; module And module list table
    Here Insert Picture Description
    3) we see that in the nested entity classes which a further entity class
    ModularDetailVo public class ModularDetailVo: SYS_ModularDetail // inherited schedule module
    {public string OpType {get; set ;} // the type of operation
    // module sheet -> type table operation (block list as required intermediary)
    }
    two entities classes inherit theModule tableas well asModule Schedule, Do so primarily to query all the required content; through the module list as intermediaries different users experience different privileges;
    4) to sort queries new ModularAndDetailVo (module from the module table according to table ID table's primary key module the entity list of the combinations class module) module ID and a query module name
    Here Insert Picture DescriptionLinq nested subquery ModularDetails module is a self-named entity class among a first detail of the module according to the operation schedule even type table (details of operation type ID module operation type equal to the type ID) and then as a result of an external condition subquery; check out the condition of sorting modules according to desired final breakdown ID details module ID, and so the operation ID / name

Guess you like

Origin blog.csdn.net/qq_42577408/article/details/89440525