C# 命名空间中不存在类型或命名空间名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10140931/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 12:36:38 来源:igfitidea点击:
type or namespace name does not exist in the namespace
提问by user1300580
I have the code below in a .cs file and I am coming across the errors below, any help would be appreciated.
我在 .cs 文件中有下面的代码,我遇到了下面的错误,任何帮助将不胜感激。
using System.Data.Entity;
namespace Assignment2.Models
{
public class TicketBookingEntities : DbContext
{
public DbSet<Performance> Performances { get; set; }
public DbSet<Production> Productions { get; set; }
}
}
Errors:
错误:
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?)
采纳答案by Daniel Hilgarth
回答by Nikhil Agrawal
Try looking for your missing references in Object Browser.
尝试在对象浏览器中查找丢失的引用。

