none
LINQ EntityReference error: The member 'PortGroup_ReferenceId' was changed to be inconsistent with the association member 'PortGroup'

    Question

  • Hi,

    I am getting this error after i set the PortGroup field to null. (PortGroup is a nullable field)
    In debug mode, i also found that PortGroup_ReferenceId is not cleared but the PortGroup field already set to null.
    I think this is the reason why it shows this error because of unmatch.
    Below is my code for this entity reference field. May i know is there any wrong with my code?

     [Column(Name = "PortGroupID", DbType = "BigInt NULL")]
            private long? PortGroup_ReferenceId;
            private EntityRef<PortGroup> _PortGroup = new EntityRef<PortGroup>();
            [Association(Name = "FK_VesselInfoDetail_PortGroup", IsForeignKey = true, Storage = "_PortGroup", ThisKey = "PortGroup_ReferenceId")]
            public PortGroup PortGroup
            {
                get { return _PortGroup.Entity; }
                set { _PortGroup.Entity = value; }
            }
    Friday, October 25, 2013 9:43 AM

Answers

  • Hello,

    Since we do not know the actual table structure, we could hardly do a test on it.

    So could you please share some more information regarding this issue?

    And for Linq To Sql, there is a walkthrough:

    http://msdn.microsoft.com/en-us/library/bb425822.aspx

    You can have a look.

    Regards.


    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.

    Monday, October 28, 2013 1:57 AM
    Moderator