InsertOnSubmit Null Ref Exception on Linq to SQL DataContext EntitySet RRS feed

  • Question

  • I’m getting a null reference exception on a Linq to SQL foreign key EntitySet when trying to add a new entity.  The problem goes away when I comment out the EntitySet code (see below).  I don’t see any AssociationAttribute to allow this entirely normal situation.  What am I doing wrong?

    Thanks.  Steve

    // Child Entity Relationship
            private EntitySet<BBDetail> _BBDetails;
            [Association(Storage = "_BBDetails", OtherKey = "BBName")]
            public EntitySet<BBDetail> BBDetails
                get { return this._BBDetails; }
                set { this._BBDetails.Assign(value); }

    Friday, April 29, 2016 12:09 PM

All replies

  • Hi Cincy,

    Could you please share a simple complete demo about the issue, which we could reproduce your issue on my side, and we will try to test it and find a solution to solve it.

    Best regards,

    Cole Wu

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, May 4, 2016 6:32 AM