EF 4.3 NullReferenceException using Annotations InverseProperty and ForeignKey RRS feed

  • Question

  • Hello,

    using EF 4.3 Code First

    I want to design two optional relations between two classes:

    After reading Entity Framework 4.1 InverseProperty Attribute and ForeignKey I designed my classes:

    public class Person
    Public Overridable Property QuestionnaireResponseQuestioningList As ICollection(Of QuestionnaireResponse)
    Public Overridable Property QuestionnaireResponseAnsweringList As ICollection(Of QuestionnaireResponse)
    end class
    public class QuestionnaireResponse
    Public Property QuestioningPerson_Id As Guid
    Public Property AnsweringPerson_Id As Guid
    Public Overridable Property QuestioningPerson As Person
    Public Overridable Property AnsweringPerson As Person
    end class

    I received NullReferenceExceptio...

    reading  Using InverseProperty on self-referencing entity in 4.3 

    I tried with one of that relations removing the InverseProperty Annotations...Building was possible --> creating a required relation.

    Should i rather use FluentAPI?

    Wednesday, March 28, 2012 12:25 PM

All replies

  • Hi Cortadillo,

    Welcome to MSDN Forum.

    Could you please clarify where the NullReferenceException is thrown?

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Friday, March 30, 2012 3:06 AM
  • Hi Cortadillo,

    Have you solved the issue? I look forward to hearing from you.

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 2, 2012 1:42 AM