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