简体   繁体   English

从vs2010迁移到vs2012后,Linq包含不起作用

[英]Linq Contains not working after migrate from vs2010 to vs2012

I just migrate my project from vs2010 to vs2012 and when I try to execute this method the statement seems to get no data. 我只是将项目从vs2010迁移到vs2012,当我尝试执行此方法时,该语句似乎没有数据。 The same code works fine on vs2010. 相同的代码在vs2010上可以正常工作。

var result2 = (dc.Table1
    .Where(p => p.Descripcion.Contains(descripcion) && p.Estado == 1)
    .GroupJoin(dc.Table2, 
        p => p.Codigo, 
        a => a.Codigo,
        (p, a) => new { p = p, a = a }
    )
    .SelectMany(
        temp => temp.a.DefaultIfEmpty(), 
        (temp, a) => new Listado() 
        { 
            codigo = temp.p.Codigo, 
            descripcion = temp.p.Descripcion, 
            alias = a.Descripcion, 
            id = a.Id 
        })
    )
    .ToList();

Any suggestion to fix the problem is welcome. 欢迎提出解决问题的任何建议。

I solve it by upgrading to EntityFramework6, it seems that EntityFramework5 still has some bugs. 我通过升级到EntityFramework6来解决它,看来EntityFramework5仍然有一些错误。 I am using the same method and data but now I'm getting the expected data. 我正在使用相同的方法和数据,但是现在我正在获取预期的数据。

我认为在升级EntityFramework时遇到了类似的问题,结果我改用了.Any()方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.Linq Linq查询无法在VS2012中工作,但在VS2010中可以正常工作 - System.Linq Linq queries not working in VS2012 but works fine in VS2010 将项目从VS2010迁移到VS2012后无法继承接口 - can't inherit interface after migrating project from VS2010 to VS2012 从VS2010移至VS2012后,HTML渲染间歇性丢失内容 - After move from VS2010 to VS2012 HTML rendering is intermittently losing content VS2012 OutOfMemoryException与VS2010没有异常的工作 - VS2012 OutOfMemoryException vs. VS2010 working w/o Exception 如何在VS2010和VS2012中加载数据库项目? - How to load database project in VS2010 and VS2012? DeploymentItem在VS2010和VS2012中的行为方式不同 - DeploymentItem behaving differently in VS2010 and VS2012 在项目开发过程中从VS2010升级到VS2012会有任何风险吗? - Is there any risk in upgrading from VS2010 to VS2012 in the middle of project development? 我可以在VS2010的VS2012中使用静态分析吗? - Can i use static analysis in VS2012 from VS2010? 从VS2010升级到VS2013(或VS2012)后,无法打开Visual Studio C#解决方案,错误消息“不支持给定路径的格式” - Can not open Visual Studio C# solution after upgrading from VS2010 to VS2013 (or VS2012), error message “The given path's format is not supported” AppFabric DataCacheFactory()初始化在VS2013中挂起,在VS2010和VS2012中正常工作 - AppFabric DataCacheFactory() initialization hangs in VS2013, works fine in VS2010 and VS2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM