我有以下實體類:public partial class ProjectUser{ public int Id { get; set; } public int ProjectId { get; set; } public int UserId { get; set; } public virtual Project Project { get; set; } public virtual Users User { get; set; }}當我執(zhí)行以下操作時:myDbContext.ProjectUser.ToList()我收到此錯誤:System.Data.SqlClient.SqlException (0x80131904): 列名稱“ProjectUser”無效我dbcontext的具有以下屬性:public virtual DbSet<ProjectUser> ProjectUser { get; set; }表格腳本如下。CREATE TABLE [dbo].[ProjectUser]( [Id] [int] IDENTITY(1,1) NOT NULL, [ProjectId] [int] NOT NULL, [UserId] [int] NOT NULL, CONSTRAINT [PK_ProjectUser] PRIMARY KEY CLUSTERED ([Id] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO怎么了?已使用腳手架生成類。
- 1 回答
- 0 關注
- 85 瀏覽
添加回答
舉報
0/150
提交
取消