public virtual void RemoveUrbanAgencies(UrbanAgency __item)
 {
     if (__item != null && urbanAgencies != null && urbanAgencies.Contains(__item))
     {
         urbanAgencies.Remove(__item);
     }
 }
 public virtual void AddUrbanAgencies(UrbanAgency __item)
 {
     if (__item != null && urbanAgencies != null && !urbanAgencies.Contains(__item))
     {
         urbanAgencies.Add(__item);
     }
 }
 public virtual void SetUrbanAgenciesAt(UrbanAgency __item, int __index)
 {
     if (__item == null)
     {
         urbanAgencies[__index] = null;
     }
     else
     {
         urbanAgencies[__index] = __item;
     }
 }
Exemple #4
0
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [UrbanAgency] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual UrbanAgency Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, UrbanAgency copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((UrbanAgency)copiedObjects[this]);
            }
            copy = copy ?? new UrbanAgency();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            copy.GTFSId = this.GTFSId;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            copy.urbanLines = new List <UrbanRoute>();
            if (deep && this.urbanLines != null)
            {
                foreach (var __item in this.urbanLines)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddUrbanLines(__item);
                        }
                        else
                        {
                            copy.AddUrbanLines(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddUrbanLines((UrbanRoute)copiedObjects[__item]);
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }