2012-01-23 1 views
2

I가 다음과 같은 계층 구조 :엔티티 프레임 워크 RIA 서비스는 어떻게 포함 개체 내에서 엔티티를 포함 할

AccountCatagory

AccountType 

    AccoungGroup 

     GeneralLedger 

      SubsidiaryLedger 

각각의 AccountCatagory는 각 ACCOUNTTYPE이 AccountGroups을 가지고 AccountTypes을 가지고 ...

트리보기에로드해야하는 항목 :

계정 카테고리를로드 할 때 모든 항목을로드해야합니다. 이 :

public IQueryable<AccountCatagory> GetAccountCatagories() 
    { 
    return this.ObjectContext.AccountCatagories.Include("AccountTypes"); 
    } 

잘 작동하지만 AccountTypes 만로드합니다. 각 AccountCatagory 내에서.

엔티티 각각에 엔티티 쓰기 GetQuery가 작동하지 않습니다.

포함 된 엔티티에 포함/엔티티도로드 할 때 RIA 서비스에 엔티티 포함을 알리는 방법은 무엇입니까?

return ObjectContext.Users.Include("AccessRole") 
    .Include("AccessRole.AccessRoleReports") 
: 여기

답변

2

은 외래 키의 모두가 제대로 설정하고 적절한 변경 도메인 서비스의 메타 데이터 파일에되었습니다 가정, 나는 나의 일을 가지고 방법의 예입니다

나는 많은 서브 타입과 객체를 포함 해본 적이 있지만, 나는이 작업을 할 수 있습니다 가정 작동

return this.ObjectContext.AccountCatagories.Include("AccountTypes") 
    .Include("AccountTypes.AccountGroups") 
    .Include("AccountTypes.AccountGroups.GeneralLedger") 
    .Include("AccountTypes.AccountGroups.GeneralLedger.SubsidiaryLedger"); 
+0

감사합니다! – mill

+0

듣기 좋다! – Chris