加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

命名空间中不存在c# – 类型或命名空间名称

发布时间:2020-12-15 04:30:46 所属栏目:百科 来源:网络整理
导读:我有一个.cs文件中的代码,我遇到下面的错误,任何帮助将不胜感激. using System.Data.Entity;namespace Assignment2.Models{ public class TicketBookingEntities : DbContext { public DbSetPerformance Performances { get; set; } public DbSetProduction
我有一个.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的引用.
请参阅如果您不知道如何添加引用,请在 this link中添加Visual C#中的引用.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读