2011-04-20 3 views
0

나는 다음과 같은 코드를 가지고 :예기치 않은 EntityObject 오류

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); 
    } 
} 

하지만 이러한 오류를 얻을 이유를 모르겠어요 :

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 

가 어떻게 이러한 오류를 고칠 수 있습니까?

+2

개발자 컴퓨터에 설치되어 있습니까? 아니면 다른 컴퓨터에 있습니까? System.Data.Entity가 bin 폴더에 있는지 확인 했습니까? –

+0

참조가 누락 된 것 같습니다. –

+0

솔루션의 구조는 무엇입니까? EF 데이터 모델 (EDMX)이 위의 코드를 호스팅하는 프로젝트가 아닌 다른 프로젝트에 있습니까? –

답변

1

나는 당신과 같이 간단하게이 작업을 수행 할 수 있다고 생각 :

var entities = new FaExpedEntities(); 
return entities.T_CLIENT.ToList(); 

당신이 필요한 참조 및 사용하여 문이 있는지 확인합니다.

희망이 있습니다.