1
我正在第一次進入Code First。我的大多數表格工作正常,但在查詢名爲Bids的表時,我收到了'無效列名稱Company_CompanyID'。實體框架代碼第一個無效的列名稱Company_CompanyID
當我逆向工程我的數據庫的一個小示例應用程序,我沒有得到這個錯誤。我已經將示例應用程序的投標類和映射與我的真實應用程序進行了比較,我找不到差異。在我的實際應用中的投標查詢生成的SQL是這樣的:
SELECT
[Extent1].[LockCount] AS [LockCount],
[Extent1].[BidID] AS [BidID],
[Extent1].[LocaleID] AS [LocaleID],
[Extent1].[Description] AS [Description],
[Extent1].[FileLocation] AS [FileLocation],
[Extent1].[EstimatorContactID] AS [EstimatorContactID],
[Extent1].[OwnerContactID] AS [OwnerContactID],
[Extent1].[OwnerContactContactID] AS [OwnerContactContactID],
[Extent1].[GCContactID] AS [GCContactID],
[Extent1].[GCContactContactID] AS [GCContactContactID],
[Extent1].[ArchitectContactID] AS [ArchitectContactID],
[Extent1].[ArchitectContactContactID] AS [ArchitectContactContactID],
[Extent1].[BuilderContactID] AS [BuilderContactID],
[Extent1].[BuilderContactContactID] AS [BuilderContactContactID],
[Extent1].[DrawingNumber] AS [DrawingNumber],
[Extent1].[BidDate] AS [BidDate],
[Extent1].[PlanDate] AS [PlanDate],
[Extent1].[RevisionDate] AS [RevisionDate],
[Extent1].[StartDate] AS [StartDate],
[Extent1].[FinishDate] AS [FinishDate],
[Extent1].[Address1] AS [Address1],
[Extent1].[Address2] AS [Address2],
[Extent1].[City] AS [City],
[Extent1].[State] AS [State],
[Extent1].[PostalCode] AS [PostalCode],
[Extent1].[J1] AS [J1],
[Extent1].[J2] AS [J2],
[Extent1].[J3] AS [J3],
[Extent1].[J4] AS [J4],
[Extent1].[J5] AS [J5],
[Extent1].[J6] AS [J6],
[Extent1].[J7] AS [J7],
[Extent1].[J8] AS [J8],
[Extent1].[PriceIndex] AS [PriceIndex],
[Extent1].[Notes] AS [Notes],
[Extent1].[Proposal] AS [Proposal],
[Extent1].[JobOptions] AS [JobOptions],
[Extent1].[LastEstimatedDate] AS [LastEstimatedDate],
[Extent1].[IsTemplate] AS [IsTemplate],
[Extent1].[Awarded] AS [Awarded],
[Extent1].[JobStatus] AS [JobStatus],
[Extent1].[LockedByUserID] AS [LockedByUserID],
[Extent1].[LockedDate] AS [LockedDate],
[Extent1].[RowVersion] AS [RowVersion],
[Extent1].[Company_CompanyID] AS [Company_CompanyID]
FROM [dbo].[Bids] AS [Extent1]
WHERE (([Extent1].[LockedByUserID] = @p__linq__0) AND (NOT ([Extent1].[LockedByUserID] IS NULL OR @p__linq__0 IS NULL))) OR (([Extent1].[LockedByUserID] IS NULL) AND (@p__linq__0 IS NULL))
所有在我的出價表中的列在查詢中表示,再加上額外的Company_CompanyID
。我不知道如何去試圖找出映射到Company_CompanyID
的東西。有人可以請提供一些指導,說明我可以如何確定Company_CompanyID
進來的原因是什麼?非常感謝!