简体   繁体   English

我创建了一个ADO.NET实体,从数据库生成但我无法使用它?

[英]I made an ADO.NET Entity, generated from a database but i cant use it?

Sorry for the noob question. 抱歉,这个菜鸟问题。 im new and i cant figure this out on google. 我是新的,我无法在谷歌上解决这个问题。

The thing is, i used to right click the project go add > new item > ADO.NET Entity and then i choose to generate it from database , afterwards i start using it by typing : 问题是,我曾经右键单击项目go add> new item> ADO.NET Entity然后我选择从数据库生成它,之后我开始使用它键入:

TheEntityName something = new TheEntityName();

but now, for some reason, whenever i type the entity name i get an error that says that it doesnt exist in the current context ? 但是现在,出于某种原因,每当我输入实体名称时,我会得到一个错误,表明它在当前上下文中存在

any idea ? 任何想法 ?

You need to know the namespace of your entity. 您需要知道实体的名称空间。 Once you know that you have two options. 一旦你知道你有两个选择。 One is adding a using statement in your view 一种是在视图中添加using语句

@using namespace

Or use the fully qualified name... 或者使用完全限定的名称......

Namespace.entity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM