首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >意外的EntityObject错误

意外的EntityObject错误
EN

Stack Overflow用户
提问于 2011-04-20 16:18:48
回答 1查看 1.4K关注 0票数 0

我有以下代码:

代码语言:javascript
复制
public IList<T_CLIENT> Get_All_Obj()
{
    try
    {
        IList<T_CLIENT> LesListe;
        using (FaExpedEntities oEntite_T = new FaExpedEntities())
        {
            var query = from o in oEntite_T.T_CLIENT select o;
            LesListe = query.ToList();
        }
        return LesListe;
    }
    catch (Exception excThrown)
    {
        throw new Exception("Err_02", excThrown);
    }
}

但是我不知道为什么我会得到这些错误:

代码语言:javascript
复制
Error 1 The type 'System.Data.Objects.DataClasses.EntityObject'is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'. C: \ Soft8 \ FA_Exped \ Code \ FrontEnd \ FaExped_FrontEnd_WebApp_Domaine \ FaExped_FrontEnd_WebApp_Business \ Le_T \ LeTclientusrstatus_Entite_BL.cs 15 42 FaExped_FrontEnd_WebApp_Business

Error 2 c: \ Soft8 \ FA_Exped \ Code \ FrontEnd \ FaExped_FrontEnd_WebSite \ Login.aspx.cs (8): error CS0246: The type or namespace name 'FaExped_FrontEnd_WebApp_Business' not found (a using directive or a reference to 'assembly is it missing?)

Error 3 'FaExped_FrontEnd_WebApp_Domaine.FaExpedEntities': type used in a using statement must be implicitly convertible to 'System.IDisposable'C: \ Soft8 \ FA_Exped \ Code \ FrontEnd \ FaExped_FrontEnd_WebApp_Domaine \ FaExped_FrontEnd_WebApp_Business \ Le_T \ LeTclient_Entite_BL.cs 22 17 FaExped_FrontEnd_WebApp_Business

如何修复这些错误?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-20 20:39:57

我认为你可以简单地这样做:

代码语言:javascript
复制
var entities = new FaExpedEntities();
return entities.T_CLIENT.ToList();

确保您有必要的引用和using语句。

希望这能有所帮助:)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5727425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档