Visual Studio 2012内部出错 - "'.' 或'('预期'

5 c# linq entity-framework

SELECT TOP 1000 [GUID]
      ,[Ticket_Number]
      ,[Created_At]
      ,[Changed_At]
      ,[Priority]
      ,[Department]
      ,[Ticket_Type]
      ,[Category]
      ,[SubCategory]
      ,[Second_Category]
      ,[Third_Category]
      ,[ZZARN]
      ,[Categorization_Hash_Key]
      ,[ZZAID]
      ,[Work_Order]
      ,[Contact_Type]
      ,[Action]
      ,[BPartner_Key]
      ,[PFT]
      ,[Ticket_Status_Code]
      ,[Ticket_Status]
      ,[Audit_Key]
  FROM [CorporateDWTest].[dbo].[SRS_Ticket_Transaction_Stage_Cleaned]
Run Code Online (Sandbox Code Playgroud)

&Design:http: //i40.tinypic.com/2ufvshz.png

我删除了其他一切,如果有人知道发布答案的人是指​​参考我的表列名称设计和结构,请随时回答.

类定义(在Model1.Context.CS(.edmx)中):

public DbSet<SRS_Ticket_Transaction_Stage_Cleaned> SRS_Ticket_Transaction_Stage_Cleaned { get; set; }
Run Code Online (Sandbox Code Playgroud)
namespace CorporateDWTesting
{
    using System;
    using System.Collections.Generic;

    public partial class CRM_Ticket_Transaction_Stage_Cleaned
    {
        public byte[] GUID { get; set; }
        public string Ticket_Number { get; set; }
        public decimal Created_At_UTC { get; set; }
        public decimal Changed_At_UTC { get; set; }
        public string Priority { get; set; }
        public string Department { get; set; }
        public string Municipality { get; set; }
        public string Ticket_Type { get; set; }
        public string Category { get; set; }
        public string SubCategory { get; set; }
        public string Address_Number { get; set; }
        public string Street1 { get; set; }
        public string Street2 { get; set; }
        public string Contact_Type { get; set; }
        public string Action { get; set; }
        public string BPartner_Key { get; set; }
        public Nullable<int> PFT { get; set; }
        public string Ticket_Status_Code { get; set; }
        public string Ticket_Status { get; set; }
        public Nullable<decimal> Due_Date_UTC { get; set; }
        public int Audit_Key { get; set; }

        public virtual Dim_Audit Dim_Audit { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

Dim_Audit:

namespace CorporateDWTesting
{
    using System;
    using System.Collections.Generic;

    public partial class Dim_Audit
    {
        public Dim_Audit()
        {
            this.Business_Partner_Stage = new HashSet<Business_Partner_Stage>();
            this.CRM_Ticket_Transaction_Stage = new HashSet<CRM_Ticket_Transaction_Stage>();
            this.CRM_Ticket_Transaction_Stage_Cleaned = new HashSet<CRM_Ticket_Transaction_Stage_Cleaned>();
            this.Dim_Audit1 = new HashSet<Dim_Audit>();
            this.Dim_Categorization = new HashSet<Dim_Categorization>();
            this.Dim_Collection_Type = new HashSet<Dim_Collection_Type>();
            this.Dim_Municipality = new HashSet<Dim_Municipality>();
            this.Dim_Response_Team = new HashSet<Dim_Response_Team>();
            this.Dim_Ticket = new HashSet<Dim_Ticket>();
            this.Fact_Service_Units = new HashSet<Fact_Service_Units>();
            this.Fact_Service_Units1 = new HashSet<Fact_Service_Units>();
            this.Fact_Ticket_Processing = new HashSet<Fact_Ticket_Processing>();
            this.Fact_Ticket_Processing1 = new HashSet<Fact_Ticket_Processing>();
            this.Initial_Categories = new HashSet<Initial_Categories>();
        }

        public int Audit_Key { get; set; }
        public Nullable<int> Parent_Audit_Key { get; set; }
        public string Table_Name { get; set; }
        public string Package_Name { get; set; }
        public Nullable<System.Guid> Package_GUID { get; set; }
        public Nullable<int> Package_Version_Major { get; set; }
        public Nullable<int> Package_Version_Minor { get; set; }
        public Nullable<System.DateTime> Execution_Start_Time { get; set; }
        public Nullable<System.DateTime> Execution_End_Time { get; set; }
        public Nullable<int> Extract_Row_Count { get; set; }
        public Nullable<int> Insert_Row_Count { get; set; }
        public Nullable<int> Update_Row_Count { get; set; }
        public Nullable<int> Error_Row_Count { get; set; }
        public Nullable<int> Table_Initial_Row_Count { get; set; }
        public Nullable<int> Table_Final_Row_Count { get; set; }
        public Nullable<int> Table_Max_Surrogate_Key { get; set; }
        public string Table_Max_Business_Key { get; set; }
        public Nullable<bool> Processing_Successful { get; set; }
        public string Error_Code { get; set; }

        public virtual ICollection<Business_Partner_Stage> Business_Partner_Stage { get; set; }
        public virtual ICollection<CRM_Ticket_Transaction_Stage> CRM_Ticket_Transaction_Stage { get; set; }
        public virtual ICollection<CRM_Ticket_Transaction_Stage_Cleaned> CRM_Ticket_Transaction_Stage_Cleaned { get; set; }
        public virtual ICollection<Dim_Audit> Dim_Audit1 { get; set; }
        public virtual Dim_Audit Dim_Audit2 { get; set; }
        public virtual ICollection<Dim_Categorization> Dim_Categorization { get; set; }
        public virtual ICollection<Dim_Collection_Type> Dim_Collection_Type { get; set; }
        public virtual ICollection<Dim_Municipality> Dim_Municipality { get; set; }
        public virtual ICollection<Dim_Response_Team> Dim_Response_Team { get; set; }
        public virtual ICollection<Dim_Ticket> Dim_Ticket { get; set; }
        public virtual ICollection<Fact_Service_Units> Fact_Service_Units { get; set; }
        public virtual ICollection<Fact_Service_Units> Fact_Service_Units1 { get; set; }
        public virtual ICollection<Fact_Ticket_Processing> Fact_Ticket_Processing { get; set; }
        public virtual ICollection<Fact_Ticket_Processing> Fact_Ticket_Processing1 { get; set; }
        public virtual GIS_Collection_Stage GIS_Collection_Stage { get; set; }
        public virtual ICollection<Initial_Categories> Initial_Categories { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*ici 2

这似乎与表列名有关。确保数据库表的列具有安全名称(例如,与 SQL 数据类型名称不同)。

如果您发布表格的结构,可能会很明显。

参考:向 linqdatasource 控件添加 orderBy 属性时出现 ParseException

更新

为了解决您的问题,请重命名GUID属性/列。

堆栈跟踪,它指向

    BatchExtensions.Delete[TEntity](IQueryable'1 source)
Run Code Online (Sandbox Code Playgroud)

然后再讨论这个方法

    public static IQueryable 
        Select(this IQueryable source, string selector, params object[] values)
Run Code Online (Sandbox Code Playgroud)

表示异常是在EntityFramework.Extended中引发的库中引发的。

您必须避免将属性命名为以下预定义类型之一(不区分大小写):

static readonly Type[] predefinedTypes = {
    typeof(Object),
    typeof(Boolean),
    typeof(Char),
    typeof(String),
    typeof(SByte),
    typeof(Byte),
    typeof(Int16),
    typeof(UInt16),
    typeof(Int32),
    typeof(UInt32),
    typeof(Int64),
    typeof(UInt64),
    typeof(Single),
    typeof(Double),
    typeof(Decimal),
    typeof(DateTime),
    typeof(TimeSpan),
    typeof(Guid),
    typeof(Math),
    typeof(Convert)
};
Run Code Online (Sandbox Code Playgroud)