简体   繁体   English

System.Linq.Dynamic.ParseException:'。' 或'('预期-VS2012错误

[英]System.Linq.Dynamic.ParseException: '.' or '(' expected - VS2012 ERROR

I have trying to run the following code: 我试图运行以下代码:

 [TestMethod]
 [TestCleanup]
 public void TestMethod3()
 {
      using (var context = new CorporateDWTestEntities1())
      {
          //Deleting every row within the OLE_DB_Destination1 table.
          var query = from c in context.SRS_Ticket_Transaction_Stage select c;
          query.Delete();
          context.SaveChanges();
      }
 }

however when it runs, I recieve an error message that states: 但是,当它运行时,我收到一条错误消息,指出:

"Message:Test method Integration_Services_Tests.UnitTest1.TestMethod3 threw exception: System.Linq.Dynamic.ParseException: '.' “消息:测试方法Integration_Services_Tests.UnitTest1.TestMethod3抛出异常:System.Linq.Dynamic.ParseException:'。 or '(' expected Test cleanup method Integration_Services_Tests.UnitTest1.TestMethod3 threw exception. System.Linq.Dynamic.ParseException: System.Linq.Dynamic.ParseException:'.' or ')' expected." 或'('预期的测试清除方法Integration_Services_Tests.UnitTest1.TestMethod3引发异常。System.Linq.Dynamic.ParseException:预期为System.Linq.Dynamic.ParseException:'。'或')'。

Does anybody know what this means and how to overcome it? 有人知道这意味着什么以及如何克服吗?

According to this question , you might need to load all of the records into memory, then call context.SRS_Ticket_Transaction_Stage.DeleteOnSubmit() for each item: 根据这个问题 ,您可能需要将所有记录加载到内存中,然后为每个项目调用context.SRS_Ticket_Transaction_Stage.DeleteOnSubmit()

[TestMethod]
[TestCleanup]
public void TestMethod3()
{
    using (var context = new CorporateDWTestEntities1())
    {
        //Deleting every row within the OLE_DB_Destination1 table.
        var query = from c in context.SRS_Ticket_Transaction_Stage select c;
        var records = query.ToList();

        foreach(var record in records) 
        {
            context.SRS_Ticket_Transaction_Stage.DeleteOnSubmit(record);
        }
        context.SubmitChanges();
    }
}

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

相关问题 System.Linq.Dynamic.ParseException: '表达式预期' - System.Linq.Dynamic.ParseException: 'expression expected' Linq to sql .Dynamic 其中:带有 System.Linq.Dynamic.ParseException 的字符串:“myTable”类型中不存在属性或字段“0” - Linq to sql .Dynamic Where: string with System.Linq.Dynamic.ParseException: No property or field '0' exists in type 'myTable' 如何解决这个问题,System.Linq.Dynamic.ParseException: No property or field asc exist in type 'TblEventsManagements'? - How to fix this issue, System.Linq.Dynamic.ParseException: No property or field asc exist in type 'TblEventsManagements'? System.Linq.Dynamic-ParseException:语法错误 - System.Linq.Dynamic - ParseException: syntax error System.Linq Linq查询无法在VS2012中工作,但在VS2010中可以正常工作 - System.Linq Linq queries not working in VS2012 but works fine in VS2010 使用C#VS2012创建新文档时出现System.MissingMethodException错误 - System.MissingMethodException error when creating new document using C# VS2012 VS2012中的项目链接器安装错误 - Project linker installation error in VS2012 Dotfuscator和VS2012 - Dotfuscator and VS2012 Crystal Reports 13.0.2(VS2012),动态图像加载 - Crystal Reports 13.0.2 (VS2012), Dynamic Image Loading 在VS2012中添加Web服务引用时出错 - Error when adding web service reference in VS2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM