fluent nhibernate HasOne WithForeignKey not working

后端 未结 6 827
故里飘歌
故里飘歌 2020-12-23 14:49

Whenever I load a Task class, the Document property is always null, despite there being data in the db.

Task class:

public class Task
{
    public vi         


        
6条回答
  •  误落风尘
    2020-12-23 15:12

    As eulerfx pointed out,

    the table structure indicates that there maybe mulitple documents for a task

    and Chris stated:

    By putting a Task_ID on the document the actual relationship is a HasMany but you have some kind of implicit understanding that there will only be one document per task.

    This is of course correct so I have reversed it so Task has a nullable Document_Id.

    Thanks to both of you for you help!

    I flipped a coin for the accepted answer, if i could tick both i would!

提交回复
热议问题