本文介绍了如何调试Linq Lambda Expression?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Entity Framework和Linq来实现。



我想知道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 => xeDateTimeStart> currentDateTime&&
currentDateTime> = xeDateTimeStart.AddMinutes(defaultReminders)&& web.config中的拼贴事件的默认提醒
xpCount()== 0)//检查事件是否尚未被推送
.Select(y => new EventPushNotification
{
Id = yeId,
EventTitle = yeEventTitle,
DateTimeStart = yeDateTimeStart,
DateTimeEnd = yeDateT imeEnd,
Location = y.e.Location,
描述= y.e.Description,
DeviceToken = y.e.DeviceToken
});


解决方案

你查看什么SQL它翻译成。
另外如果你愿意遭受性能的打击 - 你可以把它全部加载到Linq中来,并且做一个


I am using Entity Framework and Linq to Entitites.

I would like to know if there is any way in Visual Studio 2012 to debug, step by step this code.At the moment when placing a break point, the cursor go over it but not step inside.

I am more interested to see the value of x.e... not the sql generate for example.

Notes: Others free tolls or Visual Studio plugins are fine too

          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
                     });
解决方案

You can't debug a Lambda expression if your are using a Linq2Entities provider.

But you can take a look at what SQL it translate into. Also if you are willing to suffer a performance hit - you could load it all into Linq to obejcts - and do a Step by step

这篇关于如何调试Linq Lambda Expression?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:59