Fluent nHibernate: one-to-many relationship Issue

后端 未结 2 1459
鱼传尺愫
鱼传尺愫 2020-12-16 07:47

I have a problem with one-to-many relationships. I have the following domain classes:

public class Installation : Entity
{        
    pu         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 08:29

    You have to manually set the Installation Property of an Institution, specifically,

    Installation installation = TestHelper.CreateAnonymousInstallation();
    Institution institution = TestHelper.CreateAnonymousInstitution();
    institution.Installation = installation;
    installation.Institutions.Add(institution);
    

提交回复
热议问题