Help me solve one problem.
I have a project that uses Nhibernate and Fluent Nhibernate. There I created one base class (these are not real classes, but they describe my situation):
public class Document { public virtual int Id { get; private set; } public virtual Account Acc { get; private set; } }
And the mapping for him:
public class DocumentMap: ProfileEntityMap<Document> { public DocumentMap() { Id(m => m.Id); References(m => m.Acc); DiscriminateSubClassesOnColumn("Type"); } }
Then I performed a subclass:
public class PaymentDocument: Document { public virtual Card AccountCard { get; set;} }
Mapping for the PaymentDocument class:
public class PaymentDocumentMap : SubclassMap<PaymentDocument> { public PaymentDocumentMap() { References(t => t.AccountCard); } }
And after that I will try to execute this request:
payments = session.Query<PaymentDocument>() .Fetch(t => t.Acc) .Fetch(t => t.AccountCard) .ToList();
And when I insert the first selection, I get the following exception:
The reference to the object is not installed in the instance of the object.
Can someone answer me where the problem is?
source share