linq查询超时已到期

时间:2014-01-17 15:49:42

标签: c# database sql-server-2008 linq-to-entities

我有以下查询生成下一个异常

 var consumption = (from c in context.ConsumptionSet
                           join pi in context.PropertiesInstanceSet on c.PropertiesInstanceID equals pi.PropertiesInstanceID
                           join ep in context.EquipmentPropertiesSet on pi.EquipmentPropertiesID equals ep.EquipmentPropertiesID
                           join e in context.EquipmentSet on ep.EquipmentID equals e.EquipmentID
                           join b in context.BoxSet on e.BoxID equals b.BoxID
                           where (b.UserID == userId && pi.ProprietesName == property && pi.Instance == 1 && e.IsGeneral == false && c.Date <= limitDate)
                           group c by e into grp
                           select new
                           {
                               eq = grp.Key,
                               //cons = grp.OrderByDescending(c => c.ConsumptionID).FirstOrDefault(),
                               cons = grp.LastOrDefault(),
                           }).ToDictionary(e => e.eq, e => e.cons);

例外:

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding 

我尝试在连接字符串和数据库上下文中设置Connect Timeout,但是徒劳无功,没有任何作用..

请知道

0 个答案:

没有答案