using (MyDbContext ctx = new MyDbContext()) { var list = ctx.User.Where(e => e.IsDelete == false); User user = list.Where(e => e.Id == 1).FirstOrDefault(); return user; }
service和ui层都没有安装entity Proxies的情况下
MiniProfiller显示这样
而使用Microsoft.Extensions.Logging.Debug则输出的是:
SELECT `t`.`Id`, `t`.`Email`, `t`.`IsDelete`, `t`.`Name` FROM `T_User` AS `t` WHERE (`t`.`IsDelete` = FALSE) AND (`t`.`Id` = 1) LIMIT 1
而如果在UI层安装entity Proxies后有了LazyLoad后miniProfiler显示的mysql语句才变得正常