示例#1
0
        /// <inheritdoc />
        public Consumable Convert(ItemDTO value, object state)
        {
            var entity = new GenericConsumable();

            this.Merge(entity, value, state);
            return(entity);
        }
        partial void Merge(GenericConsumable entity, ItemDTO dto, object state)
        {
            var consumableDto = dto.Consumable;

            if (consumableDto == null)
            {
                return;
            }

            entity.Effect = consumableDto.Description;
            double duration;

            if (double.TryParse(consumableDto.Duration, out duration))
            {
                entity.Duration = TimeSpan.FromMilliseconds(duration);
            }
        }
        partial void Merge(GenericConsumable entity, ItemDTO dto, object state)
        {
            var details = dto.Details;

            if (details == null)
            {
                return;
            }

            var duration = details.Duration;

            if (duration.HasValue)
            {
                entity.Duration = TimeSpan.FromMilliseconds(duration.Value);
            }

            entity.Effect = details.Description;
        }
示例#4
0
 // Implement this method in a buddy class to set properties that are specific to 'GenericConsumable' (if any)
 partial void Merge(GenericConsumable entity, ItemDTO dto, object state);