In this class, we mainly study. NET,LINQ and XML
The teacher introduced US first. NET Framework, that is, by compiler C # code into CIL (Common intermediate language) and then into the CLR (Common Language Runtime).
After that, the teacher explained to us the LINQ (language-integrated query), which is the language integrated query, which is the bridge of the connection program and the database, has the following characteristics:
1. Programmers perform every day are finding and retrieving objects in memory, a database, or an XML file.
2. SQL can only search relational database, not object-oriented languages.
3. LINQ is a bridge over object-oriented languages and relational database.
4. LINQ is Sql-like, and remove the distinctions among searching an in-memory data collection, a database, or an XML docum Ent.
Then I tried myself to define and run a query
which
ienumerable<customer> result = from Customer in Customers
where customer. FirstName = = "Donna"
Select customer;
is a LINQ Query that can be seen as three parts:
1. FROM clause (Specify range variable and data source customers)
2. Filtering (filter, where)
3. Projection (map, select)
is also the declaration and initialization of a query expression does not actually execute the example of the query, and
foreach (Customer customer in result)
{
Console.WriteLine (Customer. ToString ());
}
is a LINQ to query is executed, or evaluated, when you iterate through the query result example, both of which belong to deferred query Evaluation.
Of course deferred Query evaluation also has some other content:
1. If The data source has changed between executions, the result would be different. It's desired in the most situation.
2. If you want to cache the result so that it can processed later without have to reexecute the query and you can call E Ither the ToList () or the ToArray () method to save a copy of the result.
So I tried the ToList statement
After that we learned LINQ Operations:join queries, grouping, aggregation, and sorting.
where LINQ's JOIN clause is a data source that is connected to another data source, the result is returned only if the object that satisfies the join condition exists in all the data sources.
Here are the programs that I applied join to connect customer and address together
Then we learned the group query, and here is my query code with name as the keyword
C # sixth time job