Gib*_*boK 26 c# linq debugging lambda entity-framework
我正在使用Entity Framework和Linq to Entitites.
我想知道Visual Studio 2012中是否有任何方法可以逐步调试此代码.在放置断点时,光标越过它但不会进入.
我更感兴趣的是看到xe的值..而不是例如生成的sql.
注意:我可以使用其他工具或Visual Studio插件.
IEnumerable<EventPushNotification> eventToPushCollage = eventsForEvaluation
.GroupJoin(eventCustomRepository.FindAllPushedEvents(),
e => e.Id,
p => p.PushedEventId,
(e, p) => new { e, p })
.Where(x => x.e.DateTimeStart > currentDateTime &&
currentDateTime >= x.e.DateTimeStart.AddMinutes(defaultReminders) && // Data from default reminder for collage event in web.config
x.p.Count() == 0) // Check if the Event has not being already pushed
.Select(y => new EventPushNotification
{
Id = y.e.Id,
EventTitle = y.e.EventTitle,
DateTimeStart = y.e.DateTimeStart,
DateTimeEnd = y.e.DateTimeEnd,
Location = y.e.Location,
Description = y.e.Description,
DeviceToken = y.e.DeviceToken
});
Run Code Online (Sandbox Code Playgroud)
Len*_*rri 79
请务必阅读有关此问题的官方MSDN文档:
并请在Visual Studio的用户语音页面上为此建议投票:
Allon Guralnek在2014年3月18日下午12:37评论了一种仅用键盘设置断点的方法:
@Anonymous:你今天可以通过在lambda中设置一个断点来做到这一点,从而使你能够检查进出lambda的每个值.据我所知,你不能使用鼠标在lambda中设置断点,你必须使用键盘.将光标放在lambda主体内(例如,在第一个标记上,或者在=>之后的任何内容和后面的空白处)然后按F9(或者用于放置断点的任何键盘快捷键).只有lambda语句的内部才会变为红色,并且调试器将针对lambda评估的每个项目中断(因此对于100个项目的数组,使用.Where()将导致断点达到100次).
这是我当前的Visual Studio 2013中的实际应用:

正如您所看到的,它运行良好,并允许我们查看正在测试的给定属性的值.这肯定是一个很棒的工具/救生员!:)
您可以在任何自己的代码上添加断点.
所以将光标放在'x.e'处,然后按F9.
| 归档时间: |
|
| 查看次数: |
47961 次 |
| 最近记录: |