protected BaseImmutablePerson(BaseImmutablePerson other)
		{
			var homeAddressCol = new List<ImmutableAddress>();
			foreach (ImmutableAddress otherItem in other.HomeAddressCol)
				homeAddressCol.Add(otherItem == null ? null : new ImmutableAddress(otherItem));
			HomeAddressCol = new ReadOnlyCollection<ImmutableAddress>(homeAddressCol);
			var workAddressCol = new List<ImmutableAddress>();
			workAddressCol.AddRange(other.WorkAddressCol);
			WorkAddressCol = new ReadOnlyCollection<ImmutableAddress>(workAddressCol);
			var stringCol = new List<string>();
			foreach (string otherItem in other.StringCol)
				stringCol.Add(otherItem == null ? null : string.Copy(otherItem));
			StringCol = new ReadOnlyCollection<string>(stringCol);
			var stringCol2 = new List<string>();
			stringCol2.AddRange(other.StringCol2);
			StringCol2 = new ReadOnlyCollection<string>(stringCol2);
			var doubleCol = new List<double>();
			doubleCol.AddRange(other.DoubleCol);
			DoubleCol = new ReadOnlyCollection<double>(doubleCol);
			var doubleCol2 = new List<double>();
			doubleCol2.AddRange(other.DoubleCol2);
			DoubleCol2 = new ReadOnlyCollection<double>(doubleCol2);
			if (other.HomeAddressProp == null)
				this.HomeAddressProp = null;
			else
				this.HomeAddressProp = new Address(other.HomeAddressProp);
			this.WorkAddressProp = other.WorkAddressProp;
		}
		protected BaseImmutablePerson(IEnumerable<ImmutableAddress> homeAddressCol, IEnumerable<ImmutableAddress> workAddressCol, IEnumerable<string> stringCol, IEnumerable<string> stringCol2, IEnumerable<double> doubleCol, IEnumerable<double> doubleCol2, Address homeAddressProp, Address workAddressProp)
		{
			HomeAddressCol = new ReadOnlyCollection<ImmutableAddress>(new List<ImmutableAddress>(homeAddressCol));
			WorkAddressCol = new ReadOnlyCollection<ImmutableAddress>(new List<ImmutableAddress>(workAddressCol));
			StringCol = new ReadOnlyCollection<string>(new List<string>(stringCol));
			StringCol2 = new ReadOnlyCollection<string>(new List<string>(stringCol2));
			DoubleCol = new ReadOnlyCollection<double>(new List<double>(doubleCol));
			DoubleCol2 = new ReadOnlyCollection<double>(new List<double>(doubleCol2));
			HomeAddressProp = homeAddressProp;
			WorkAddressProp = workAddressProp;
		}
示例#3
0
		public Address(Address other)
		: base(other)
		{
		}
		public virtual void CopyFrom(Address other)
		{
			Street = other.Street;
			if (other.City == null)
				City = null;
			else
				City = string.Copy(other.City);
			ZipCode = other.ZipCode;
		}
		public virtual ImmutablePersonBuilder SetWorkAddressProp(Address workAddressProp)
		{
			this.workAddressProp = workAddressProp;
			return this;
		}
		public virtual ImmutablePersonBuilder SetHomeAddressProp(Address homeAddressProp)
		{
			this.homeAddressProp = homeAddressProp;
			return this;
		}
		protected virtual bool SetWorkAddressProp(Address workAddressProp)
		{
			if (this.workAddressProp == workAddressProp)
				return false;
				
			NotifyPropertyChanging(PROPERTIES.WORK_ADDRESS_PROP);
			
			RemoveWorkAddressPropListeners(this.workAddressProp);
			
			this.workAddressProp = workAddressProp;
			
			AddWorkAddressPropListeners(this.workAddressProp);
			
			NotifyPropertyChanged(PROPERTIES.WORK_ADDRESS_PROP);
			
			return true;
		}
		protected virtual bool SetHomeAddressProp(Address homeAddressProp)
		{
			if (this.homeAddressProp == homeAddressProp)
				return false;
				
			NotifyPropertyChanging(PROPERTIES.HOME_ADDRESS_PROP);
			
			RemoveHomeAddressPropListeners(this.homeAddressProp);
			
			this.homeAddressProp = homeAddressProp;
			
			AddHomeAddressPropListeners(this.homeAddressProp);
			
			NotifyPropertyChanged(PROPERTIES.HOME_ADDRESS_PROP);
			
			return true;
		}
		public virtual void CopyFrom(Person other)
		{
			HomeAddressCol.Clear();
			foreach (Address otherItem in other.HomeAddressCol)
				HomeAddressCol.Add(otherItem == null ? null : new Address(otherItem));
			WorkAddressCol.Clear();
			WorkAddressCol.AddRange(other.WorkAddressCol);
			if (other.lazyAddressCol != null)
			{
				LazyAddressCol.Clear();
				foreach (Address otherItem in other.LazyAddressCol)
					LazyAddressCol.Add(otherItem == null ? null : new Address(otherItem));
			}
			else
			{
				if (this.lazyAddressCol != null)
					this.lazyAddressCol.Clear();
			}
			StringCol.Clear();
			foreach (string otherItem in other.StringCol)
				StringCol.Add(otherItem == null ? null : string.Copy(otherItem));
			StringCol2.Clear();
			StringCol2.AddRange(other.StringCol2);
			DoubleCol.Clear();
			DoubleCol.AddRange(other.DoubleCol);
			DoubleCol2.Clear();
			DoubleCol2.AddRange(other.DoubleCol2);
			if (other.HomeAddressProp == null)
				HomeAddressProp = null;
			else
				HomeAddressProp = new Address(other.HomeAddressProp);
			WorkAddressProp = other.WorkAddressProp;
		}
示例#10
0
		public ImmutablePerson(IEnumerable<ImmutableAddress> homeAddressCol, IEnumerable<ImmutableAddress> workAddressCol, IEnumerable<string> stringCol, IEnumerable<string> stringCol2, IEnumerable<double> doubleCol, IEnumerable<double> doubleCol2, Address homeAddressProp, Address workAddressProp)
		: base(homeAddressCol, workAddressCol, stringCol, stringCol2, doubleCol, doubleCol2, homeAddressProp, workAddressProp)
		{
		}
		public virtual ImmutablePerson WithWorkAddressProp(Address workAddressProp)
		{
			return new ImmutablePerson(HomeAddressCol, WorkAddressCol, StringCol, StringCol2, DoubleCol, DoubleCol2, HomeAddressProp, workAddressProp);
		}