Beispiel #1
0
        private void FixupAddress(Address previousValue)
        {
            if (previousValue != null && previousValue.ResidentUsers.Contains(this))
            {
                previousValue.ResidentUsers.Remove(this);
            }

            if (Address != null)
            {
                if (!Address.ResidentUsers.Contains(this))
                {
                    Address.ResidentUsers.Add(this);
                }
                if (AddressId != Address.Id)
                {
                    AddressId = Address.Id;
                }
            }
            else if (!_settingFK)
            {
                AddressId = null;
            }
        }
Beispiel #2
0
        private void FixupBirthAddress(Address previousValue)
        {
            if (previousValue != null && previousValue.BornedUsers.Contains(this))
            {
                previousValue.BornedUsers.Remove(this);
            }

            if (BirthAddress != null)
            {
                if (!BirthAddress.BornedUsers.Contains(this))
                {
                    BirthAddress.BornedUsers.Add(this);
                }
                if (BirthAddressId != BirthAddress.Id)
                {
                    BirthAddressId = BirthAddress.Id;
                }
            }
            else if (!_settingFK)
            {
                BirthAddressId = null;
            }
        }