2010-09-22 71 views
0

我正在嘗試在RIA服務中使用NHibernate。目前我有兩個實體:Ria服務未在客戶端填充複雜屬性

public class Person{ 
    [Key] 
    public virtual int Id {get; set;} 
    [Include] 
    [Association("CurrentEmployer", "CurrentEmployerId", "Id", IsForeignKey = true)] 
    public virtual Employer CurrentEmployer { get;set;} 
    public virtual int? CurrentEmployerId {get;set;} 
} 
public class Employer{ 
    [Key] 
    public virtual int Id {get;set;} 
    public virtual string Name {get;set;} 
} 

當我通過利雅得到一個人的實體上CurrentEmployerId設置客戶端,但CurrentEmployer仍然是空。在服務器端,CurrentEmployerIdCurrentEmployer都已正確填充。 Employer實體和Person實體都在相同的域服務中公開。

當我找到一個人時,我如何在客戶端填充CurrentEmployer?我錯過了一個屬性?

回答

0

我發現爲什麼CurrentEmployer爲空。我從DomainContext

_domainContext.People.Detach(foundPerson); 

分離的Person之前,我訪問CurrentEmployer財產。

相關問題