摘要:
本文中举例用到的数据模型如下:Student和Class之间是多对一关系,Student和Course之间是多对多关系。DataContext的DeferredLoadingEnabled属性指定是否需要延时加载,其默认值为true。以Student为例,其延时加载的对象是指Class和对应的Cou... 阅读全文
posted @ 2015-11-04 16:53
hbsfgl
阅读(208)
评论(0)
推荐(0)
摘要:
在linq to sql中grouping很简单、很灵活,但是如果不注意则会中了Microsoft的糖衣炮弹。本文使用的数据模型如下图:1. 用linq to sql写一个最简单的group语句:查询Students表并按ClassID分组,输出每个班级的学生数。下面的代码是糖衣版。12345678... 阅读全文
posted @ 2015-11-04 16:43
hbsfgl
阅读(190)
评论(0)
推荐(0)
摘要:
先看一个最简单的inner join,在读取Student表时inner join Class表取的对应的Class信息:static void Main(string[] args){ using (var writer = new StreamWriter(WatchSqlPath, fa... 阅读全文
posted @ 2015-11-04 16:28
hbsfgl
阅读(189)
评论(0)
推荐(0)

浙公网安备 33010602011771号