// Comes from the LINQ samples provided by Microsoft //Copyright (C) Microsoft Corporation. All rights reserved. using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.Reflection; public class ObjectDu…
demo: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace MYLinqConsole { public class ProcessGet { public static void DisplayProcesses() { List<proce…
Program.cs class Program { static void Main(string[] args) { NoMethodLogging(); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); SimpleMethodLogging(); Console.WriteLine("Press any key to continue..."); Console.Re…
显式加载 讲解之前,先来看一下我们的数据库结构:班级表 学生表 加载从表集合类型 //显示加载 Console.WriteLine("=========查询集合==========="); using (var db = new Entities()) { var query = from v in db.Classes where v.ClassName == "机电10501" select v; var cls = query.Single(); db.Ent…
讲解之前,先来看一下我们的数据库结构:班级表 学生表 延迟加载 //延迟加载 using (var db = new Entities()) { //查询班级 var classes = (from v in db.Classes where v.ClassName == "机电10501" select v).Single(); if (classes.Student != null) { //遍历该班级所有学生 foreach (var st in classes.Student)…