簡體   English   中英

命名空間中不存在類型或命名空間名稱

[英]type or namespace name does not exist in the namespace

我在 .cs 文件中有下面的代碼,我遇到了下面的錯誤,任何幫助將不勝感激。

using System.Data.Entity;

namespace Assignment2.Models
{
    public class TicketBookingEntities : DbContext
    {
        public DbSet<Performance> Performances { get; set; }
        public DbSet<Production> Productions { get; set; }
    }
}

錯誤:

Error   1   The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Error   2   The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
Error   3   The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)
Error   4   The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)

確保您的項目包含對EntityFramework.dll的引用。
如果您不知道如何添加引用,請參閱此鏈接中的主題在 Visual C#中添加引用。

嘗試在對象瀏覽器中查找您丟失的引用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM