public virtual void RemovePropulsionTypeCost(PropulsionTypeCost __item)
 {
     if (__item != null)
     {
         InternalRemovePropulsionTypeCost(__item);
     }
 }
        public void DistanceCosts_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _vehiculebo_propulsiontypecost_distancecosts = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PropulsionTypeCost
            {
                Cost = 222222.22M,
                AverageConsumption = 222222.22M,
                Percentage         = 222222.22M,
            };
            var _vehiculebo_propulsiontypecost_distancecosts2 = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PropulsionTypeCost
            {
                Cost = 222222.22M,
                AverageConsumption = 222222.22M,
                Percentage         = 222222.22M,
            };

            new PersistenceSpecification <DSS3_LogisticsPoolingForUrbanDistribution.BO.DistanceCosts>(Session)
            .CheckProperty(p => p.TotalDistanceDriven, 222222.22M)
            .CheckProperty(p => p.TotalDistanceService, 222222.22M)
            .CheckProperty(p => p.OilCost, 222222.22M)
            .CheckProperty(p => p.OilConsumption, 222222.22M)
            .CheckProperty(p => p.TireCost, 222222.22M)
            .CheckProperty(p => p.YearlyReparationCost, 222222.22M)
            .CheckProperty(p => p.Cost, 222222.22M)
            .CheckProperty(p => p.TireConsumption, 222222.22M)
            .CheckBag(p => p.PropulsionTypeCost, (new List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PropulsionTypeCost>
            {
                _vehiculebo_propulsiontypecost_distancecosts,
                _vehiculebo_propulsiontypecost_distancecosts2
            }))
            .VerifyTheMappings();
        }
 public virtual void AddAtIndexPropulsionTypeCost(int index, PropulsionTypeCost __item)
 {
     if (__item == null)
     {
         return;
     }
     propulsionTypeCost?.Insert(index, __item);
 }
 public virtual void AddPropulsionTypeCost(PropulsionTypeCost __item)
 {
     if (__item == null)
     {
         return;
     }
     InternalAddPropulsionTypeCost(__item);
 }
 public virtual void InternalRemovePropulsionTypeCost(PropulsionTypeCost __item)
 {
     if (__item == null)
     {
         return;
     }
     propulsionTypeCost?.Remove(__item);
 }
 public virtual void InternalAddPropulsionTypeCost(PropulsionTypeCost __item)
 {
     if (__item == null || disableInternalAdditions)
     {
         return;
     }
     propulsionTypeCost?.Add(__item);
 }
 public virtual void SetPropulsionTypeCostAt(PropulsionTypeCost __item, int __index)
 {
     if (__item == null)
     {
         propulsionTypeCost[__index] = null;
     }
     else
     {
         propulsionTypeCost[__index] = __item;
     }
 }
/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(PropulsionTypeCost compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
/// <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 [PropulsionTypeCost] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual PropulsionTypeCost Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, PropulsionTypeCost copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((PropulsionTypeCost)copiedObjects[this]);
            }
            copy = copy ?? new PropulsionTypeCost();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.Cost = this.Cost;
            copy.AverageConsumption = this.AverageConsumption;
            copy.Percentage         = this.Percentage;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.oilType != null)
            {
                if (!copiedObjects.Contains(this.oilType))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.OilType = this.OilType;
                    }
                    else if (asNew)
                    {
                        copy.OilType = this.OilType.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.oilType = this.oilType.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.OilType = (OilType)copiedObjects[this.OilType];
                    }
                    else
                    {
                        copy.oilType = (OilType)copiedObjects[this.OilType];
                    }
                }
            }
            return(copy);
        }